Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save nhatdong/7709278 to your computer and use it in GitHub Desktop.

Select an option

Save nhatdong/7709278 to your computer and use it in GitHub Desktop.
add_filter( 'walker_nav_menu_start_el', 'add_description_secondary_menu_position', 10, 4 );
/**
* @example http://wp.me/p1lTu0-8Fq
* @author Brad Dalton - WP Sites
*/
function add_description_secondary_menu_position( $item_output, $item, $depth, $args ) {
$args = (array) $args;
if ( $args['theme_location'] != 'secondary' ) {
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output );
}
else {
return $item_output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment