Community Forums › Forums › Archived Forums › General Discussion › Structural wraps and navigation in header right widget
Tagged: header navigation, structural wraps, widgets
- This topic has 5 replies, 3 voices, and was last updated 10 years, 4 months ago by nakamoura.
-
AuthorPosts
-
November 3, 2013 at 3:59 pm #70719anynameMember
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
November 7, 2013 at 7:43 pm #71590CathyEarleMemberI'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?
November 8, 2013 at 4:31 am #71647anynameMemberStill 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
November 8, 2013 at 11:08 am #71693CathyEarleMemberThanks so much for the response "AnyName" I'll see if I can use your work around. Appreciate you sharing.
November 8, 2013 at 2:49 pm #71781CathyEarleMemberI 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
AdventuresI 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?
November 12, 2013 at 10:06 am #72474 -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.