in Wordpress Themes by aleksandrx100 (160 points)
Hi, I want to add a user name to the top menu, using function:

add_filter ('wp_nav_menu', 'do_menu_shortcodes');
function do_menu_shortcodes ($menu) {
        return do_shortcode ($menu);
}

add_shortcode ('current-username', 'username_on_menu');
function username_on_menu () {
    $user = wp_get_current_user ();
    $user-return> user_login;
}

But the short-code [current-username] doesn't work. In standard subjects (Twenty Sixteen) this function works. How to make that in the subject TemplateToaster 6 too worked? Thanks

2 Answers

by sarah (15.2k points)
Hi,

TemplateToaster WordPress themes use its own custom menu walker function called "templatetoaster_theme_nav_menu" in functions.php file. So you can insert or call shortcode functionality  in "templatetoaster_theme_nav_menu" function.
by aleksandrx100 (160 points)
edited by aleksandrx100
Set an example please
Interested in localizing/Translating TemplateToaster Software in your native language in exchange of a Pro License ? Contact Us
...