Structural wraps and navigation in header right widget

Community Forums Forums General Discussion Structural wraps and navigation in header right widget

This topic is: not resolved

This topic contains 5 replies, has 3 voices, and was last updated by  nakamoura 8 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #70719

    anyname
    Participant
    Post count: 21

    More genesis structural wrap issues.

    According to the documentation genesis allows inbuilt structural wrapping for the html5 ‘nav’ tag when using add theme support for genesis-structural-wraps:

    http://my.studiopress.com/snippets/structural-wraps/

    This seems to work fine when the menu is placed in the primary or secondary menu area. However when using the custom menu widget to put the menu in the header right widget area then nav isn’t wrapped. Frustrating.

    Quite possibly this is due to the ordering of the calls that are used to append the wrap div. Either way it’s a bug or feature that the genesis dev people need to look at for the next framework release.

    There are woirkarounds using genesis_header_right and wp_nav_menu but its quite messy and probably something non-developers would want to tackle.

    Thanks

    • This topic was modified 8 months, 3 weeks ago by  anyname. Reason: typo
    • This topic was modified 8 months, 3 weeks ago by  anyname. Reason: typo
    #71590

    CathyEarle
    Participant
    Post count: 48

    I’m working on Minimum Theme and would like to do this also – wrap in the custom menu section.

    Any updates on this or work arounds?

    #71647

    anyname
    Participant
    Post count: 21

    Still an issue. No word from the Genesis people on this or the other structural wrap issue.

    In the end I used a non widget workaround: Your theme functions.php

    
    //* Custom header menu
    add_action( 'genesis_header_right', 'sk_header_menu', 5 );
    function sk_header_menu() {
    
    	//set header menu classes
    	$class = 'menu genesis-nav-menu menu-header';
    	if ( genesis_superfish_enabled() ) { $class .= ' js-superfish'; }
    	$args = array(
    		'menu' 		=> 'Main Menu',
    		'theme_location' 	=> '',
    		'container'      	=> '',
    		'menu_class'     	=> $class,
    		'menu_id' 	=> 'menu-main-menu',
    		'echo'           	=> 0
    	);
    
    	//add header menu
    	$headernav = wp_nav_menu( $args );
    
    	//test menu
    	if ( ! $headernav ) { return; }
    
    	//set up structural markup
    	$headernav_markup_open = genesis_markup( array(
    		'html5'   => '<nav %s>',
    		'xhtml'   => '<div id="header-menu">',
    		'context' => 'nav-header',
    		'echo'    => false
    	) );
    	$headernav_markup_open 	.= genesis_structural_wrap( 'nav', 'open', 0 );
    	$headernav_markup_close	 = genesis_structural_wrap( 'nav', 'close', 0 );
    	$headernav_markup_close	.= genesis_html5() ? '</nav>' : '</div>';
    	$headernav_output 	 = $headernav_markup_open . $headernav . $headernav_markup_close;
    
    	//output menu
    	echo apply_filters( 'sk_do_headernav', $headernav_output, $headernav, $args ); 
    }
    

    This was using a menu called ‘Main Menu’ I created as normal in the admin menu section. You’ll obviously have to change this and the id’s

    • This reply was modified 8 months, 3 weeks ago by  anyname.
    • This reply was modified 8 months, 3 weeks ago by  anyname.
    • This reply was modified 8 months, 3 weeks ago by  anyname.
    • This reply was modified 8 months, 3 weeks ago by  anyname.
    #71693

    CathyEarle
    Participant
    Post count: 48

    Thanks so much for the response “AnyName” I’ll see if I can use your work around. Appreciate you sharing.

    #71781

    CathyEarle
    Participant
    Post count: 48

    I implemented the code above and it works but ……

    I guess I was confused about how the structural wrap works. What I actually want to do is have certain words within the navigation appear on two lines. So for example if the word was Summer Adventures instead of the words appearing beside each other they sit one below the other like

    Summer
    Adventures

    I see another type of example used on this site’s navigation: http://genesistutorials.com/ where there is a main menu then smaller descriptive words underneath. I’d like the ability to do either. Not sure what I should search for in the forum to find the answer to this?

    #72474

    nakamoura
    Participant
    Post count: 6

    Thank you @anyname for sharing this solution it is working perfect.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.