• Resolved akewowo

    (@akewowo)


    Hello

    I would like to add a [language-switcher] shortcode to the header
    i tried to put it in header text but it shows the text only

    thank you

    Cyril

    (the shortcode is from the plugin “translatepress” i use on my site

    I added this php to the functions
    add_filter( ‘widget_text’, ‘shortcode_unautop’);
    add_filter( ‘widget_text’, ‘do_shortcode’);
    it works on text blocks but not on the header of the mobile menu

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rui Guerreiro

    (@takanakui)

    Hi @akewowo,

    Let’s try to use a filter that exists in the right menu that you are not using at the moment.

    So enable the right menu and add the code below to the functions.php of your child theme. Try with and without the return if it doesn’t work.

    
    /*WP Mobile Menu Rigth Menu Content Filter*/
    function my_custom_html_right_menu() {
    
    return do_shortcode('[language-switcher]');
    }
    
    add_filter( 'mm_right_menu_filter', 'my_custom_html_right_menu' );
    Thread Starter akewowo

    (@akewowo)

    Thank you Rui

    it works

    Cyril

    • This reply was modified 5 years, 6 months ago by akewowo.
    Plugin Author Rui Guerreiro

    (@takanakui)

    That’s great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘add shortcode to header’ is closed to new replies.