Jump to content
Sign in to follow this  
scotmanfrontiernetnet

Global Nav Tutorial

Recommended Posts

scotmanfrontiernetnet

I was following along with this tutorial found under docs and I am a little stumped. I have the latest WP Revision and the latest PlatformPro theme. I would much rather code this in than run another addon seeings how the functionality is already provided for us. http://www.pagelines.com/docs/custom-sections Trying to create a global nav as per their instructions but it isn't showing up in the admin section under site header or the menu section. I created a file in wp-content/themes/platformpro/sections/sectionglobalnav.php

<?php
	/*
	
		Section: Global Navigation
		Author: Adam Munns
		Description: Creates global site navigation, with optional superfish dropdowns.
		Version: 1.0.0
	
	*/
	
	class BaseGlobalNav extends PageLinesSection {
	
	   function __construct( $registered_settings = array() ) {
	
			$name = __('GlobalNav Section', 'pagelines');
			$id = 'globalnav';
			$settings = array(
					'description' => 'Creates a Global Nav Section in the base',
					'workswith' 	=> array('header'),
					'icon'			=> CORE_IMAGES . '/admin/map.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
							}
	
		// PHP that always loads no matter if section is added or not -- e.g. creates menus, locations, admin stuff...
		function section_persistent(){
	
			register_nav_menus( array( 'globalnav' => __( 'Global Navigation', 'pagelines' ) ) );
	
		}
		}
		}
		
According to the video tutorial this should be showing up under the layout section under site header, which I don't see it and it is also to show up as a section under wp menus which I don't see either. I added the following code in the functions file found at /member/wp-content/themes/platformpro/functions.php
<?php
	/*
	
		THEME INITIALIZATION
	
		This file loads the core framework for Platform which handles everything.
	
		This theme copyright (C) 2008-2010 PageLines
	
	*/
	
		require_once(TEMPLATEPATH . "/core/core.init.php");
	
		function base_sections(){
	
		pagelines_register_section('BaseGlobalNav', 'globalnav', null, array('child' => true) );
	}
	?>

Share this post


Link to post
Share on other sites
catrina

Are you using the child theme, PlatformBase at all or just PlatformPro to make the changes?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
scotmanfrontiernetnet

I'm using the platform pro not the child theme to make changes.

Share this post


Link to post
Share on other sites
scotmanfrontiernetnet

Got this to work on child theme but I am getting...

Warning: Cannot modify header information - headers already sent by (output started at /home/nicheweb/public_html/webcontentcourse.com/member/wp-content/themes/platformbase/sections/section.globalnav.php:1) in /home/nicheweb/public_html/webcontentcourse.com/member/wp-includes/pluggable.php on line 890

Share this post


Link to post
Share on other sites
scotmanfrontiernetnet

I also get this code when trying to edit or create a new page...not sure what is going on. I attached an image to show you how the new nav menu is formated too...AM.png

Warning: Cannot modify header information - headers already sent by (output started at /home/nicheweb/public_html/webcontentcourse.com/member/wp-content/themes/platformbase/sections/section.globalnav.php:1) in /home/nicheweb/public_html/webcontentcourse.com/member/wp-includes/classes.php on line 1601

Share this post


Link to post
Share on other sites
Andrew

@Scot, you are getting that error because a customization you added (or a plugin) is causing HTML to be outputted before it is supposed to. Any idea what would cause that?

Share this post


Link to post
Share on other sites
scotmanfrontiernetnet

Thanks AP I disabled all plugins. Been checking for white spaces as well. Most likely a customization I added I will have to check and troubleshoot this more. Now you have me thinking, thanks for telling me what it most likely would be and what exactly is taking place. I'm going to mark this resolved if you guys don't see anything obvious in the code. Thanks to both of you for your help.

Share this post


Link to post
Share on other sites
scotmanfrontiernetnet

[10-Jan-2011 00:36:54] PHP Warning: Invalid argument supplied for foreach() in /home/nicheweb/public_html/webcontentcourse.com/member/wp-includes/functions.php on line 1184 This seems like the culprit. I edited the wrong function file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×