Archived

This topic is now archived and is closed to further replies.

  • 0

How to add additional custom menu? (2)

Question

Posted · Report post

Hi, I've read this post http://www.pagelines.com/forum/topic.php?id=3055 because I need also an additional custom menu so I've created a php file called section.global.php and I've added and the appropriate code into the functions.php file (as explained in the video). Everything seems to work perfect in the backend. I've done the settings (header layout and WP menus) but my globalnav doesn't show up in my site. Do i still have to change something in the CSS or add html code somewhere to make that menu visible in my site? Thanks for your answer

Share this post


Link to post
Share on other sites

17 answers to this question

Posted · Report post

Hi Bryan, Thank you for the advice. But for now, i'm running my site in localhost with MAMP which has the PHP 5.3.2 version. Besides if I didn't have PHP5, I wouldn't have been able to install Pagelines. The PHP code I sent (above) is all correct? Thank you and sorry to insist

Share this post


Link to post
Share on other sites

Posted · Report post

Benoit I'm going to close the other post so we don't double up. So you have a section and a menu created? Can I get a link to look at whether the HTML for it is there?

Share this post


Link to post
Share on other sites

Posted · Report post

It seems like it's pulling the callback function despite having the options set. Also, make sure that although you've set the menu location you hit save for both the menu and the location in APPEARANCE - Menus because the saving mechanism for it is nit-picky

Share this post


Link to post
Share on other sites

Posted · Report post

I believe I'm running into the same problem. Any idea what I should do? I have every page showing up on my globalnav menu instead of the ones that I've chosen. Screencast here...

Share this post


Link to post
Share on other sites

Posted · Report post

OK. sorry for the double post. Unfortunatly my server still have PHP4 version so I cannot install platformpro. I'll try to update it. actually I work with MAMP in local. But when I inspect the HTML with Firebug, I get that code :

<div class="container fix" id="globalnav">
	<div class="texture">
	<div class="content">
	<div class="content-pad">
	<div class="global" id="primarynav"></div><div class="clear"></div>
	</div>
	</div>

Share this post


Link to post
Share on other sites

Posted · Report post

any clue what the problem with the pages could be? I'd really like to add this Globalnav to my site. Thanks by advance

Share this post


Link to post
Share on other sites

Posted · Report post

It's hard to say what's going on, but you could just hard code the menu instead? Is that a possibility...what sort of links do you need?

Share this post


Link to post
Share on other sites

Posted · Report post

Eduardo, Adam, yes, I did all the settings in the backend... and it works perfectly when I add my GlobalNav to the content section or to the footer. it doesn't work only when I add it to the header section where I already have my main-nav. It seems to be a CSS confict between the main-nav and the top-nav (or global-nav). Both use the same div id but different classes. Should i use an other Id for the global-nav and update files section.globalnav.php and the base.css. How? Thank you

Share this post


Link to post
Share on other sites

Posted · Report post

Hi Adam, Yes I've set the menu location for both the menu and the location in APPEARANCE. (see test link below) Here's what I've set : Primary nav (green) = page about, page 1, page 2. Global nav = page 3, page 4. I have 2 problems : 1. The global nav is invisible if set above the primary nav 2. It takes all the pages of the site (for menu items) and not only the pages I've set (page 3, 4) Here is a test link to see the test site and check the code : http://www.benoitcloson.com/beta_site/ Thanks again for checking Beno?®t

Share this post


Link to post
Share on other sites

Posted · Report post

I've just made a slight change in the wp_nav_menu function and it works now. I don't really understand why?

<?php if(function_exists('wp_nav_menu')):
		wp_nav_menu( array('main-nav'=>'globalnav') );
				endif;?>
I change
array ('theme_location'
by
('main-nav'

Thank you

Share this post


Link to post
Share on other sites

Posted · Report post

hmmm it appears the location exists but it's not picking it up and using the fallback function. Try removing everything in the wp_nav_menu function so it's like this and see what happens. ` <?php if(function_exists('wp_nav_menu')): wp_nav_menu( array('theme_location'=>'globalnav') ); endif;?> `

Share this post


Link to post
Share on other sites

Posted · Report post

Hmm... When I tested it worked for me. Even if there was conflict it wouldn't be CSS. Maybe dropdowns though if you copied the nav exactly, but it's hard for me to say without a link to check it out. Or link to an image of your new nav file.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi Adam, I still don't have server with PHP5 so I'll show you pictures. I hope it helps to understand. I saw indeed that it has nothing to do with the CSS. Here are my problems with the global nav : 1. The global nav is only visible when I position it below the site branding and the primary nav. If I place it above, it's invisible. I don't now why? see : http://www.benoitcloson.com/pagelines/header_section.png http://www.benoitcloson.com/pagelines/home.png 2. It always takes the primary nav content by default. Even when I set a specific content for Global nav in the Menus settings. see : http://www.benoitcloson.com/pagelines/menus.png I've done the test using the demo content. Here is the PHP code I use (which a copy of yours)

	<?php
	/*
	
		Section: Global Navigation
		Author: Adam Munns
		Description: Creates site navigation.
		Version: 1.0.0
	
	*/
	
	class BaseGlobalNav extends PageLinesSection {
	
	   function __construct( $registered_settings = array() ) {
	
			$name = __('GlobalNav Section', 'pagelines');
			$id = 'globalnav';
	
			$default_settings = array(
				'workswith' => array('header'),
				'description' => 'Creates a Global Nav Section in base.',
				'icon'			=> CHILD_IMAGES . '/icon-pullquote.png'
			);
	
		   parent:GDN__construct($name, $id, $settings);
	   }
	   function section_template() {
	
		?><div id="primary-nav" class="global"><?php
	
		if(function_exists('wp_nav_menu')){
				wp_nav_menu( array('menu_class'  => 'main-nav', 'container' => null, 'container_class' => '', 'depth' => 3, 'theme_location'=>'globalnav', 'fallback_cb'=>'nav_fallback') );
	
				}
		?></div><?php
	   			}
	
		function section_persistent(){
	
			register_nav_menus( array( 'global' => __( 'Global Navigation', 'pagelines' ) ) );
	
		}
	    }
	
	/*
		End of section class
	*/
	

Share this post


Link to post
Share on other sites

Posted · Report post

Maybe I was using a deprecated function parameters? Hard to believe going from 3.0 to 3.01? Glad you got it though

Share this post


Link to post
Share on other sites

Posted · Report post

It partially solved the problem : Now I can set the globalnav above the main nav and it stays visible but it sill takes all the pages of the site (for menu items) and not only the pages I've set (page 3, 4). http://www.benoitcloson.com/beta_site/ Thank you

Share this post


Link to post
Share on other sites

Posted · Report post

I think that the issue that needs to be addressed is PHP. It's very important to get you on PHP5. If we don't there will always be issues to workaround. Please see here for good hosts: http://wordpress.org/hosting/ Thanks, Bryan

Share this post


Link to post
Share on other sites