Created
April 28, 2014 04:53
-
-
Save reneeschel/11362086 to your computer and use it in GitHub Desktop.
widget in nav wrap
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
genesis_register_sidebar( array( | |
'id' => 'nav-widget', | |
'name' => __( 'Nav Menu Widget', 'A Sample' ), | |
'description' => __( 'This is your custom nav menu widget.', 'wpsites.net' ), | |
) ); | |
add_filter( 'wp_nav_menu_items', 'nav_menu_widget', 10, 2 ); | |
add_filter('widget_text', 'do_shortcode'); | |
//* Credit to http://www.rfmeier.net/ for part of this code. | |
function nav_menu_widget( $menu, stdClass $args ){ | |
genesis_structural_wrap( 'widget'); | |
//Change primary to secondary here if needed | |
if ( 'primary' != $args->theme_location ) | |
return $menu; | |
if( genesis_get_option( 'nav_extras' ) ) | |
return $menu; | |
if ( is_active_sidebar( 'nav-widget' ) ) | |
genesis_widget_area( 'nav-widget', array( | |
'before' => '<div class="nav-widget widget-area">', | |
'after' => '</div>', | |
) ); | |
genesis_structural_wrap( 'widget', 'close'); | |
echo '</div>'; | |
return $menu; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
widget for nav within the wrap.