At the end of your Navigation Walker you can just append to the $output
like so:
$output .= apply_filters(
'walker_nav_menu_start_el'
, $item_output
, $item
, $depth
, $args
);
// This is before the ending list item:
$output .= '<span>Inner Navigational Text</span>';
To get the post meta (I’m not familiar with ACF) you can use $item->object_id
which will be the actual post ID ($item->ID
is the navigation item ID, not the post ID).
IF you want to add the content into the actual link you’ll have to pre-create your content block, store it in a variable (let’s say $navContent
), then you’ll have to replace the current link with the following:
$item_output = sprintf( '%1$s<a%2$s>%3$s%4$s%5$s%6$s</a>%7$s',
$args->before,
$attributes,
$args->link_before,
apply_filters( 'the_title', $item->title, $item->ID ),
$args->link_after,
$navContent,
$args->after
);
If you’re familiar with sprinf()
this will make sense but if not, it just replaces the %6$s with the 6th variable in the argument list. The s
indicates that it’s a string which is why you’ll want to create your content block before hand.