Jump to content


Photo
- - - - -

Float Navbar To Right Of Branding/logo Image


Best Answer Evan Mattson , 26 October 2012 - 03:34 AM

Hey there biosopher,

Nice to see someone who isn't afraid to get their feet wet with the core code! I hope you're not editing core files though :rolleyes:

It seems like you're trying to stick the navbar into your branding section, correct? It really isn't necessary to mess with the template map like that.

Actually, if you look in the section.php for the navbar itself, there is an example of how you can insert a section on any hook. That's how the fixed navbar works. Check out the block starting on line 164 of the navbar's section.php:

 
if(ploption('navbar_fixed')){

build_passive_section(array('sid' => $this->class_name));

add_action( 'pagelines_before_page', create_function( '', 'echo pl_source_comment("Fixed NavBar Section");' ) );
add_action('pagelines_before_page', array(&$this,'passive_section_template'), 10, 2);


pagelines_add_bodyclass('navbar_fixed');
}

This code could be duplicated and modified to run on another hook (like inside the branding section). This code must run from within the navbar section's class though, so to customize it, just copy the navbar section's folder from core into your child theme's sections folder. Just change the action's hook to where you want your passive navbar to go ('pagelines_before_page' to 'your_hook'). Change the added bodyclass to something else if you need it, otherwise you could leave that out.

Good luck! Go to the full post


  • This topic is locked This topic is locked
8 replies to this topic

#1 biosopher

biosopher

    Member

  • Members
  • 14 posts
  • Framework Version:Pagelines Pro v2.3
  • Country: Country Flag

Posted 24 October 2012 - 11:38 PM

Please checkout my site to see the problem:

Please Login or Register to see this Hidden Content

.

As you can see, I've floated my PLNavBar to the right of my logo. However I now have two PLNavBars appearing, and I've spent multiple hours trying to determine where this 2nd PLNavBar is coming from.

In the_template_map() of class.template.php, I've separated the 'pagelines_header' hook as below so that I control when the PLNavBar is created and placed:

Please Login or Register to see this Hidden Content


And using Pagelines Customize Plugin, I added this function to add the PLNavBar myself:

Please Login or Register to see this Hidden Content


The above code works because I updated Branding's section.php with an additional hook within brandings <div>:

Please Login or Register to see this Hidden Content


So all should be well, but that 2nd PLNavBar is showing up...which it shouldn't as I'm only calling PLNavBar once via add_header_nav(). My ONLY clue thus far is that the 2nd PLNavBar can be removed on a Page-by-Page basis using the WP admin. So it seems the WP admin knows about this 2nd PLNavBar. Is it creating it somehow?

Any suggestions?

#2 Danny

Danny

    Is Awesome!

  • Moderators
  • 16897 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 25 October 2012 - 07:44 AM

Hi,

Unfortunately, we are unable to provide support for custom code you have created. If you need assistance with this type of customisation, I recommend you contact one of our pros -

Please Login or Register to see this Hidden Content



However, why don't you simply use the BrandNav section, which contains your logo aligned to the left and your navigation aligned to the right.

#3 biosopher

biosopher

    Member

  • Members
  • 14 posts
  • Framework Version:Pagelines Pro v2.3
  • Country: Country Flag

Posted 25 October 2012 - 04:06 PM

My question is less about custom code and more about how Pagelines template areas is structured.

This is what I get 'out of the box' with aligning right. The Nav bar displays the the right BUT below the logo and looks awkward.

{IMAGE GOES HERE]

Hmmm....this forum's fairly antiquated. I can't find a way to upload an image of my site to share. Very disappointing!

#4 biosopher

biosopher

    Member

  • Members
  • 14 posts
  • Framework Version:Pagelines Pro v2.3
  • Country: Country Flag

Posted 25 October 2012 - 06:10 PM

Trying to contact a Pro now. Sadly it's been 1.5 hours and no email response. I'd hoped the Pros would be more responsive as I'm more than wiling to pay a few $$hundred to resolve this issue.

#5 mackenzie

mackenzie

    Advocate

  • Members
  • 333 posts
  • Country: Country Flag

Posted 26 October 2012 - 12:05 AM

Have you heard back from a Pro yet?

#6 Evan Mattson

Evan Mattson

    Super Member

  • Members

  • 231 posts
  • LocationAnn Arbor, MI
  • Framework Version:latest stable & beta releases
  • Country: Country Flag

Posted 26 October 2012 - 03:34 AM   Best Answer

Hey there biosopher,

Nice to see someone who isn't afraid to get their feet wet with the core code! I hope you're not editing core files though :rolleyes:

It seems like you're trying to stick the navbar into your branding section, correct? It really isn't necessary to mess with the template map like that.

Actually, if you look in the section.php for the navbar itself, there is an example of how you can insert a section on any hook. That's how the fixed navbar works. Check out the block starting on line 164 of the navbar's section.php:

Please Login or Register to see this Hidden Content


This code could be duplicated and modified to run on another hook (like inside the branding section). This code must run from within the navbar section's class though, so to customize it, just copy the navbar section's folder from core into your child theme's sections folder. Just change the action's hook to where you want your passive navbar to go ('pagelines_before_page' to 'your_hook'). Change the added bodyclass to something else if you need it, otherwise you could leave that out.

Good luck!

#7 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 30 October 2012 - 04:48 PM

Did Evan's advice help?

#8 miketaylorphoto

miketaylorphoto

    Advanced Member

  • Members

  • 64 posts
  • LocationToronto
  • Framework Version:Developer
  • Country: Country Flag

Posted 18 March 2013 - 06:45 PM

This is exactly what I would like to do Evan. Is there anyway you could explain the steps a little more detailed Im kinda a noobie



#9 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 18 March 2013 - 11:57 PM

Mike,

 

This is an old topic and outdated due to the updates in Framework in the past 6 months. Please write a new topic.

 

Thanks for your understanding.