Jump to content
Sign in to follow this  
msaizan

Parse syntax error - custom section to add new global navabar

Recommended Posts

msaizan

grrrr...i am "attempting" to create a custom section to add a second global navabar above the branding (pagelines pro, bse). i have faithfully followed the instructions in the video tutorial in the docs, checked and rechecked and compared my code to what's on screen in the tutorial and to make sure all my curlys exist and/or closed where they need to be...in fact, several times - and still no cigar. did some research and found that one of the most common reasons for this error is because of the use of short codes. tried changing short codes to long form php code but still no cigar. Can anybody help me out here? i really want that navabar. section is unregistered in functions right now so i can keep working but as soon as i register and refresh here's what i am getting: Parse error: syntax error, unexpected $end in /home/mattheww/public_html/wp-content/themes/platformbase/sections/section.globalnav.php on line 39 and this is my code:

<?php
	/*
		Section: GlobalNav Section
		Author: PageLines
		Description: Displays a Global Site Navigation
		Version: 1.0.0
	
		*/
	class BaseGlobalNav extends PageLinesSection {
	   function __construct( $registered_settings = array() ) {
	
			$name = __('GlobalNav Section', 'pagelines');
			$id = 'globalnav';
			$settings = array(
				'description' 	=> 'GlobalNav Section - Creates a GlobalNav Section in Base',
				'workswith' 	=> array('header'),
				'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( 'globalnav' => _ _( 'Global Navigation', 'pagelines') ) );
	
	            }
	
	            }/* End of section class - No closing tag needed */
	
and this is how i am registering at functions.php
pagelines_register_section('BaseGlobalNav','globalnav',null, array('child' => true) );

Share this post


Link to post
Share on other sites
bryan-hadaway

Marking for developer review. Thanks, Bryan

Share this post


Link to post
Share on other sites
Andrew

ahhh found it, you forgot to close your `if` statement. Good for you though, once you figure this out you'll be rockin!

Share this post


Link to post
Share on other sites
intellagentz

Can I please ask that you detail this step-by-step in a written tutorial to accompany the video. This is a useful option to include and I would go one step further in asking that you consider adding this functionality in a future build version.

Share this post


Link to post
Share on other sites
msaizan

i second the motion. It would be great to have a written tutorial to accompany the video and I would like to see this functionality built in - Since PL theme already supports three custom menu placements makes sense to give us a second global option to choose there - i think the theme would benefit from an above the branding global - and/or second global horizontal menu bar option that matches style of the primary. in general the folks who are building e- commerce sites would need that option/ positioning. i am still stumped on the IF statement and my eyes are starting to glaze over now! if anybody wants to throw me an additional bone and ramp up the karma love around here i'll take it. i am not lazy - i love to learn - just a month behind on the completion of this website!

Share this post


Link to post
Share on other sites
Andrew

I know! Better Docs are coming, we are mixing them in as we develop all the features you guys are asking for...

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  

×