Created
October 29, 2014 12:29
-
-
Save lmartins/e3d7dbf0791285c26b44 to your computer and use it in GitHub Desktop.
Add menu items programatically
This file contains 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
add_filter( 'genesis_nav_items', 'be_follow_icons', 10, 2 ); | |
add_filter( 'wp_nav_menu_items', 'be_follow_icons', 10, 2 ); | |
/** | |
* Follow Icons in Menu | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/genesis-wordpress-nav-menu-content/ | |
* | |
* @param string $menu | |
* @param array $args | |
* @return string | |
*/ | |
function be_follow_icons($menu, $args) { | |
$args = (array)$args; | |
if ( 'primary' !== $args['theme_location'] ) | |
return $menu; | |
$follow = '<li id="follow">Follow: <a rel="nofollow" class="rss" href="'.get_bloginfo('rss_url').'"><img src="'.get_bloginfo('stylesheet_directory').'/images/feed.png" /></a> <a rel="nofollow" class="twitter" href="'.esc_url( 'http://twitter.com/' .genesis_get_option('nav_extras_twitter_id') ).'"><img src="'.get_bloginfo('stylesheet_directory').'/images/twitter.png" /></a></li>'; | |
return $menu . $follow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment