• Resolved Manuel Marquez

    (@manudeoli)


    Hello,
    I’m building a website with woocommerce and the estore theme. I want to add a switcher language shortcode ([language-switcher] from translatepress) in the top bar, but the shortcode does not work. Do you have an idea of the problem?
    wordpress version : 5.4.2
    Thanks for help

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @manudeoli,

    I took an in depth look on the matter and I came to realize that the customizer field where you are adding shortcode has been sanitized (in layman’s terms – only text will appear) so the shortcode won’t work. I recommend you to use the other option provided by the plugin such as adding the language switcher on Menu item or Floating language which is working perfectly.

    Thanks and regards,
    Milan.

    Thread Starter Manuel Marquez

    (@manudeoli)

    Hi Milan,
    Thanks a lot for your answer.
    It’s a shame because my client would like to see this feature in top bar. Isn’t there a solution to prevent code cleanup? It’s amazing because in the theme customization editor, there is the button to add the shortcode, but when I click on it, nothing happens…

    Hi @manudeoli,

    I implemented the language switcher in the top bar and it looks like this. To achieve this, first you have to create a child theme, if you don’t have an idea about it then please go through this link https://themegrill.com/blog/tutorial-creating-wordpress-child-theme/.

    Now that you have a child theme, create header.php file and copy the code from the parent theme. If you are a developer it won’t be hard for you to locate the place to insert the shortcode if you aren’t, then add the shortcode code after a line that says ‘endif; // woocommerce check’ that should do the trick. The code you should insert is echo do_shortcode( '[language-switcher]' ); .

    Thanks and regards,
    Milan

    • This reply was modified 4 years, 9 months ago by Milan Thapa.
    • This reply was modified 4 years, 9 months ago by Milan Thapa.
    Thread Starter Manuel Marquez

    (@manudeoli)

    Hi Milan,
    It works perfect, thank you very much !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode in top bar doesn’t work’ is closed to new replies.