How to add Primary and Secondary Navigation Widgets to Genesis Navigation Bars.
Add the following code to your WordPress theme’s function.php file, or a functionality plugin to add Primary and Secondary Navigation Widgets to Genesis.
/* Custom Nav right hand side extra */
add_filter( 'genesis_nav_items', 'social_follow_icons', 10, 3 );
add_filter( 'wp_nav_menu_items', 'social_follow_icons', 10, 3 );
function social_follow_icons($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
ob_start();
dynamic_sidebar('Social Icons');
$social = ob_get_clean();
return $social . $menu;
}
/* Custom Nav right hand side extra */
add_filter( 'genesis_nav_items', 'google_search', 10, 2);
add_filter( 'wp_nav_menu_items', 'google_search', 10, 2);
function google_search($menu, $args) {
$args = (array)$args;
if ( 'secondary' !== $args['theme_location'] )
return $menu;
ob_start();
dynamic_sidebar('Google Search');
$social = ob_get_clean();
return $social . $menu;
}
genesis_register_sidebar( array(
'id' => 'google-search',
'name' => __( 'Google Search', 'marketing' ),
'description' => __( 'Primary Navigation Search Box.', 'marketing' ),
) );
genesis_register_sidebar( array(
'id' => 'Social-Icons',
'name' => __( 'Social Icons', 'marketing' ),
'description' => __( 'Secondary Navigation Social Icons.', 'marketing' ),
) );
Share Your Two Cents