-
-
Save bcoco/7c536ada433231622408a070514b621b to your computer and use it in GitHub Desktop.
Adding Simple Social Icons to Navigation bar in Genesis. http://sridharkatakam.com/adding-simple-social-icons-navigation-bar-genesis/
This file contains hidden or 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-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; | |
} |
This file contains hidden or 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-nav-menu .widget { | |
float: right; | |
} | |
.genesis-nav-menu .simple-social-icons ul li { | |
margin-bottom: 0 !important; | |
margin-top: 0.7rem !important; | |
} |
This file contains hidden or 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-nav-menu .widget-area { | |
float: right; | |
padding-top: 2.2rem; | |
} |
This file contains hidden or 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-nav-menu .widget-area { | |
float: right; | |
padding-top: 1.5rem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rather than floating the icons, you can use flex to order them nicely... just apply it to the menu itself. For example, this adds them to the end of a centered, horizontal menu (as in a footer) :
.genesis-nav-menu { display: flex; flex-direction: row; justify-content: center; }
From there, it's just a matter of adjusting the css to match.