I’m trying to figure out, where in the roots walker I can get the wordpress menu descriptions. When I create my own walker, then , of course, the nice roots walker is not working. Do you have any ideas where to grap the menu descriptions in the roots walker?
The description will be contained in $item->description
. To add your own markup use one of the WordPress filters or create your own walker by extending the Roots_Nav_Walker
class.
just if someone is still looking for a simple way to achive this:
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<span class=\"nav-desc\">{$desc}</span><", $item_output);
}
If you wanted to apply this just to the prime nav, how?