Skip to content

Instantly share code, notes, and snippets.

@QROkes
Last active February 26, 2016 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QROkes/50b58bcbd575ddf458bc to your computer and use it in GitHub Desktop.
Save QROkes/50b58bcbd575ddf458bc to your computer and use it in GitHub Desktop.
Add widget to the Primary Menu (Wordpress & Genesis Framework)
// 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