Update to Genesis 2.1.0 broke style for secondary nav bar

Community Forums Forums General Discussion Update to Genesis 2.1.0 broke style for secondary nav bar

This topic is: not resolved

Tagged: 

This topic contains 26 replies, has 16 voices, and was last updated by  Andrea Rennick 5 months, 3 weeks ago.

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #112124

    jimpepe
    Participant

    I rolled back to 2.0.2 to fix the problem, but is there a workaround or adjustment I need to make to my child theme’s style sheet?

    #112166

    klutchtech
    Participant
    Post count: 6

    I’m having the same problem with the Corporate Theme. The upgrade to Genesis 2.1.0 broke the styling for the Secondary Menu, specifically because it is now using <div id=”nav”></div> to wrap the Primary and Secondary Menu. Previously the Primary Menu was wrapped in <div id=”nav”></div> and the Secondary Menu was wrapped in <div id=”subnav”></div>.

    You can check out my site at http://ktsandbox.com and see how the Primary and Secondary Menu bars are now styled identically because if this problem.

    They should be styled like the Corporate Theme demo: http://demo.studiopress.com/corporate/. In the demo, the Primary Menu is black and the Secondary menu is grey.

    Anyone have a fix for this yet?

    Thanks!

    #112193

    meta13
    Participant
    Post count: 1

    Same here.

    Looks like <div id="subnav"> changed to <div id="nav">.

    There are now two <div id="nav">‘s if you are using both the main nav and subnav.

    Is this a bug or did something change that we should know about with 2.1?

    #112200

    digitalnordic
    Member
    Post count: 1

    Same with Backcountry Theme.

    #112205

    sylviabass
    Member
    Post count: 1

    Hi, noticed the same thing with Prose. Both menus are now using “nav” as the ID, so I’m unable to style the submenu using Genesis > Design Settings. Reverted back to 2.02 for now until there is a fix.

    #112216

    Gary Jones
    Moderator
    Post count: 693

    I’ll look into it.


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #112217

    nutsandbolts
    Keymaster
    Post count: 3202

    Hi guys,

    Just wanted to let you know that the dev team is aware of the issue and looking into it. This only seems to be affecting pre-HTML5 themes as far we know. I’ll keep you posted if I hear any updates!

    Edited to add: And I see Gary beat me to it. :)


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    • This reply was modified 5 months, 3 weeks ago by  nutsandbolts.
    • This reply was modified 5 months, 3 weeks ago by  nutsandbolts.
    #112221

    klutchtech
    Participant
    Post count: 6

    Thank you Gary and Andrea!

    #112231

    Gary Jones
    Moderator
    Post count: 693

    Found the problem – it’s my fault.

    With that out of the way, here’s a working fix.

    Open up Genesis 2.1 files, specifically lib/functions/menu.php

    Go down to line 72.

    Replace the whole of the function (line 72 start “function genesis_get_nav_args(….” and ending on line 142 which just has the closing brace “}”) with the following:

    function genesis_get_nav_menu( $args = array() ) {
    
    	$args = wp_parse_args( $args, array(
    		'theme_location' => '',
    		'container'      => '',
    		'menu_class'     => 'menu genesis-nav-menu',
    		'echo'           => 0,
    	) );
    
    	//* If a menu is not assigned to theme location, abort
    	if ( ! has_nav_menu( $args['theme_location'] ) ) {
    		return;
    	}
    
    	$sanitized_location = sanitize_key( $args['theme_location'] );
    
    	$nav = wp_nav_menu( $args );
    
    	//* Do nothing if there is nothing to show
    	if ( ! $nav ) {
    		return;
    	}
    
    	$xhtml_id = $args['theme_location'];
    
    	if ( 'primary' === $args['theme_location'] ) {
    		$xhtml_id = 'nav';
    	} elseif ( 'secondary' === $args['theme_location'] ) {
    		$xhtml_id = 'subnav';
    	}
    
    	$nav_markup_open = genesis_markup( array(
    		'html5'   => '<nav %s>',
    		'xhtml'   => '<div id="' . $xhtml_id . '">',
    		'context' => 'nav-' . $sanitized_location,
    		'echo'    => false,
    	) );
    	$nav_markup_open .= genesis_structural_wrap( 'menu-' . $sanitized_location, 'open', 0 );
    
    	$nav_markup_close  = genesis_structural_wrap( 'menu-' . $sanitized_location, 'close', 0 );
    	$nav_markup_close .= genesis_html5() ? '</nav>' : '</div>';
    
    	$nav_output = $nav_markup_open . $nav . $nav_markup_close;
    
    	$filter_location = 'genesis_' . $sanitized_location . '_nav';
    
    	//* Handle back-compat for primary and secondary nav filters.
    	if ( 'primary' === $args['theme_location'] ) {
    		$filter_location = 'genesis_do_nav';
    	} elseif ( 'secondary' === $args['theme_location'] ) {
    		$filter_location = 'genesis_do_subnav';
    	}
    
    	/**
    	 * Filter the navigation markup.
    	 *
    	 * @since 2.1.0
    	 *
    	 * @param string $nav_output Opening container markup, nav, closing container markup.
    	 * @param string $nav Navigation list (<code><ul></code>).
    	 * @param array $args {
    	 *     Arguments for <code>wp_nav_menu()</code>.
    	 *
    	 *     @type string $theme_location Menu location ID.
    	 *     @type string $container Container markup.
    	 *     @type string $menu_class Class(es) applied to the <code><ul></code>.
    	 *     @type bool $echo 0 to indicate <code>wp_nav_menu()</code> should return not echo.
    	 * }
    	 */
    	return apply_filters( $filter_location, $nav_output, $nav, $args );
    }

    That gets rid of the hard-coded nav and allows it to be subnav dealing with the secondary menu.


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #112236

    John Chadwick
    Member
    Post count: 13

    Hi Gary and Andrea!

    I am creating a bunch of niche blogs for other users and before I go live with them I would like to know if this issue is going to be fixed as a new release? All the niche blogs use the pre HTML5 Lifestyle theme. I can’t release them knowing that a potential owner will have to go into the core code and edit it. I guess I could edit one of the installs and then clone it but could the next Genesis update knock out the secondary nav again? Thanks for your hard work on the new update……..love Genesis!

    Kind regards,

    John

    #112244

    Gary Jones
    Moderator
    Post count: 693

    The next release of Genesis will have this fixed. I’ve posted a solution for Nathan, so it’s up to him to accept it, improve it if necessary, and when to do a new release. But I know he won’t let another release go out without this being fixed.

    Andrea has confirmed my code is working, so if you’re happy to do the fix yourself, then go for it.

    If you can wait a day or two (I would hope Genesis 2.1.1 is out tomorrow, since we currently have broken the appearance of secondary menus on all XHTML themes that were using the ID as a styling hook), then that would be my current recommendation.

    (Usual disclaimer – I don’t work for Copyblogger, so I don’t officially represent them or their views)


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #112246

    klutchtech
    Participant
    Post count: 6

    That worked! Our live site http://www.Stranaska.com is displaying the Secondary Menu correctly now. Thank you for looking in to this so quickly!

    ~ Kelli

    • This reply was modified 5 months, 3 weeks ago by  klutchtech.
    • This reply was modified 5 months, 3 weeks ago by  klutchtech.
    #112249

    Gary Jones
    Moderator
    Post count: 693

    Glad to hear it’s working for you as well klutchtech


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #112289

    Dawn
    Participant
    Post count: 12

    I’m having this same issue with Blissful, but this coding fix isn’t working for me. Any ideas?

    http;//www.homemakinghacks.com

    Thanks!

    • This reply was modified 5 months, 3 weeks ago by  Dawn.
    • This reply was modified 5 months, 3 weeks ago by  Dawn.
    #112342

    Gary Jones
    Moderator
    Post count: 693

    Did you clear your hosts cache etc Dawn?

    If you want to send me with some FTP login details (server, port, username, password), then I can see if I can get it working for you. https://gamajo.com/contact


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

Viewing 15 posts - 1 through 15 (of 27 total)

You must be logged in to reply to this topic.