Last active
February 26, 2016 00:35
-
-
Save QROkes/50b58bcbd575ddf458bc to your computer and use it in GitHub Desktop.
Add widget to the Primary Menu (Wordpress & Genesis Framework)
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 widget to the Primary Menu (Social Icons) | |
genesis_register_sidebar( array( | |
'id' => 'nav-social-menu', | |
'name' => __( 'Nav Social Menu', 'text-domain' ), | |
'description' => __( 'Primary menu widget for social icons.', 'text-domain' ), | |
) ); | |
add_filter( 'genesis_nav_items', 'qr_social_icons', 10, 2 ); | |
add_filter( 'wp_nav_menu_items', 'qr_social_icons', 10, 2 ); | |
function qr_social_icons($menu, $args) { | |
$args = (array)$args; | |
if ( 'primary' != $args['theme_location'] ) | |
return $menu; | |
ob_start(); | |
genesis_widget_area('nav-social-menu'); | |
$social = ob_get_clean(); | |
return $menu . $social; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment