Skip to content

Instantly share code, notes, and snippets.

@SiGaCode
Created January 10, 2017 18:42
Show Gist options
  • Save SiGaCode/65ebc6f6bf065327d4bc03df35901462 to your computer and use it in GitHub Desktop.
Save SiGaCode/65ebc6f6bf065327d4bc03df35901462 to your computer and use it in GitHub Desktop.
Add a widget area (for social icons in this example) to primary nav. Credits: Sridhar Katakam. https://gist.github.com/srikat/8171174#file-functions-php-L4
/* Just samples, might not fit for your childtheme. Adjust for your needs! */
.genesis-nav-menu .widget {
float: right;
}
.genesis-nav-menu .simple-social-icons ul li {
margin-bottom: 0 !important;
margin-top: 0.7rem !important;
}
.genesis-nav-menu .widget-area {
float: right;
padding-top: 1.5rem;
}
// Goes to Dynamik Custom - Functions or your skin PHP file
genesis_register_sidebar( array(
'id' => 'nav-social-menu',
'name' => __( 'Nav Social Menu', 'your-theme-slug' ),
'description' => __( 'This is the nav social menu section.', 'your-theme-slug' ),
) );
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
function sws_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