Created
January 29, 2012 11:46
-
-
Save GaryJones/1698437 to your computer and use it in GitHub Desktop.
Selectively remove title attributes on Genesis-created (vestigial) menus
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
<?php | |
// Optionally remove from WP custom menus too | |
add_filter( 'wp_nav_menu_items', 'child_remove_primary_navigation_titles', 10, 2); | |
add_filter( 'genesis_nav_items', 'child_remove_primary_navigation_titles', 10, 2 ); | |
/** | |
* Remove all title attributes on Genesis-created navigation menus in the primary location. | |
* | |
* @author Gary Jones | |
* @link http://code.garyjones.co.uk/remove-genesis-navigation-titles#being-selective | |
* | |
* @param string $menu HTML markup of menu list items. | |
* @param array $args Menu arguments associative array. | |
* | |
* @return string HTML markup. | |
*/ | |
function child_remove_primary_navigation_titles( $menu, $args ) { | |
if ( 'primary' == $args['theme_location'] ) | |
$menu = preg_replace( '/ title="[^"]*"/', '', $menu ); | |
return $menu; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment