
Untitled
By: a guest on
Jun 17th, 2012 | syntax:
None | size: 0.42 KB | hits: 15 | expires: Never
/** Add description to secondary navigation */
add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 );
function add_description( $item_output, $item, $depth, $args ) {
$args = (array) $args;
if ( $args['theme_location'] != 'primary' ) {
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output );
}
else {
return $item_output;
}
}