Last active
November 15, 2016 18:40
-
-
Save sarahmonster/e99db050ffdb14ac4296fc76a23d7e56 to your computer and use it in GitHub Desktop.
Add a priority-plus navigation pattern to WordPress themes. Make sure to remove the menu-toggle button and make the main nav ul display block by default!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Add an extra li to our nav for our priority+ navigation to use | |
*/ | |
function themeslug_add_more_to_nav( $items, $args ) { | |
if ( 'menu-1' === $args->theme_location ) : | |
$items .= '<li id="more-menu" class="menu-item menu-item-has-children"><a href="#">'; | |
$items .= easy_as_svg_get_icon( 'more' ); | |
$items .= '<span class="screen-reader-text">'. esc_html( 'More') . '</span></a><ul class="sub-menu"></ul></li>'; | |
endif; | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_items', 'themeslug_add_more_to_nav', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment