
One of the students in my Family Tree class asked how I replaced the Nav Extras RSS links with my own Social Media (RSS, Facebook and Twitter) links (including icons). It’s pretty simple, really. The code from Creativity Included was pulled into the recently renovated Family Tree theme in the example pictured above.
functions.php
First, I filter out the old RSS links
remove_filter('genesis_nav_items', 'genesis_nav_right', 10, 2);
remove_filter('wp_nav_menu_items', 'genesis_nav_right', 10, 2);
Then I create a new function to replace the one I removed
add_filter('genesis_nav_items', 'child_nav_right', 10, 2);
add_filter('wp_nav_menu_items', 'child_nav_right', 10, 2);
function child_nav_right($menu, $args) {
Next I check to see if the nav extras are enabled

$args = (array)$args;
if( !genesis_get_option('nav_extras_enable') || $args['theme_location'] != 'primary' )
return $menu;
if(genesis_get_option('nav_extras') == 'rss') {
I set up a variable to hold the RSS link info
$rss = '<a rel="nofollow" href="'.get_bloginfo('rss_url').'">RSS</a>';
I do the same for my Twitter link info
$twitter = '<a rel="nofollow" href="https://twitter.com/username" target="_blank">Twitter</a>';
And finally my Facebook link info
$facebook = '<a rel="nofollow" href="http://www.facebook.com/pages/City-ST/Business-Name/999999999999" target="_blank">Facebook</a>';
I string them together to build the menu component
$menu .= '<li class="right rss"><span class="rss-icon">'.$rss.'</span> <span class="twitter-icon">'.$twitter.'</span> <span class="facebook-icon">'.$facebook.'</span></li>';
}
Otherwise, I want to use the default nav right menu
else {
$menu = genesis_nav_right($menu, $args);
}
return $menu;
}
style.css
Edit the block of code flagged /* rss option
This basically sets up a unique icon for each link. The hover state changes the background position, allowing you to have a rollover effect. Sprites rule!
#nav li .rss-icon a, #nav li .twitter-icon a, #nav li .facebook-icon a {
overflow: hidden;
margin: 0 0 0 10px;
padding: 3px 0 3px 18px;
}
#nav li .rss-icon a {
background: url(images/icon-rss.png) no-repeat 0 0;
}
#nav li .twitter-icon a {
background: url(images/icon-twitter.png) no-repeat 0 0;
}
#nav li .facebook-icon a {
background: url(images/icon-facebook.png) no-repeat 0 0;
}
#nav li .rss-icon a:hover, #nav li .rss-icon a:active, #nav li .rss-icon a:focus, #nav li .twitter-icon a:hover, #nav li .twitter-icon a:active, #nav li .twitter-icon a:focus, #nav li .facebook-icon a:hover, #nav li .facebook-icon a:active, #nav li .facebook-icon a:focus {
background-position: 0 -18px;
}
