Trying to customize/personnalize a Navigation Menu Title for my Users

I am trying to customize a Navigation Menu Title for my Users.
Example: User Name: Joe
Result: Menu Joe

  1. I created a widget Menu (using: User Menu)
  2. I created a template (id=10300) in which I have this code:
    <User name />
  3. In my Navigation Menu Widget Title, I have this:
    Menu [template id=10300]
  4. On Frontend it shows: Menu [template id=10300]

Obviously, I did something wrong.

Any clue would be appreciate. Thanks.

Hi Stanley! I’m pretty sure WP doesn’t parse shortcodes in widget titles. Could you try using an HTML, Text or Shortcode widget instead?

Possibly with a simple filter:

add_filter('widget_title', 'do_shortcode');

Source: How to Use Shortcodes in Post/Page/Widget Titles

2 Likes

@avanti Thank you so much for your solution.
It works. I just copy/pasted these two lines inside a code snippets:

add_filter('the_title', 'do_shortcode');
add_filter('widget_title', 'do_shortcode');

and this inside my widget title:
Menu [template id=10300]

Much appreciated.

2 Likes