Last active
December 15, 2015 20:48
-
-
Save nickdavis/5320863 to your computer and use it in GitHub Desktop.
Change Twitter link in Genesis Primary Navigation Extras to open in new window
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', 'nd_twitter_tweak', 10, 2 ); | |
add_filter( 'wp_nav_menu_items', 'nd_twitter_tweak', 10, 2 ); | |
/** | |
* Change Twitter link in Genesis Primary Navigation Extras to open in new window | |
* @author Nick Davis (adpated from Bill Erickson code in the link below) | |
* @author Bill Erickson | |
* @link https://gist.github.com/esanctuary/5320863 | |
* @link http://www.billerickson.net/genesis-wordpress-nav-menu-content/ | |
* | |
* @param string $menu | |
* @param array $args | |
* @return string | |
*/ | |
function nd_twitter_tweak($menu, $args) { | |
$args = (array)$args; | |
if ( 'primary' !== $args['theme_location'] ) | |
return $menu; | |
$follow = '<li class="right twitter"><a href="' . esc_url( 'http://twitter.com/' . genesis_get_option( 'nav_extras_twitter_id' ) ) . '" target="_blank">' . esc_html( genesis_get_option( 'nav_extras_twitter_text' ) ) . '</a></li>'; | |
return $menu . $follow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment