I’ve looked and have not found anything that works.
I am trying to include a shortcode in a menu item’s ‘Navigation Label’. Basically Iwould like to have a dynamic title displaying the user’s name & avatar.
[profilepicture round] [user_name]
Right now it’s just spit back out since WordPress Menus do not parse shortcodes. I’ve tried:
function my_nav_menu_objects_shortcode_mangler($items) {
foreach ($items as $item) {
$item->title = do_shortcode($item->title);
}
return $items;
}
But it doesn’t parse it. I also tried $item->type_label with no luck. Am I just referencing the wrong attribute of item?
Also tried the following with no luck.
add_filter('wp_nav_menu_items', 'do_shortcode');
The avatar and username can both be retrieved via php if needed:
<?php echo userpro_profile_data('user_login', $user_id); ?>
<?php echo userpro_profile_data('profilepicture', $user_id); ?>