Translation

Hi,

I would like to have a translation option to my pages and posts. I have installed the google translate plugin, but I can’t get it to work…

Copy/Paste this shortcode if adding to pages/posts: [google-translator]
Copy/Paste this code if adding to header/footer: <?php echo do_shortcode(’[google-translator]’); ?>

Can you help me?
Many thanks!

Try adding this code to functions.php file to enable shortcodes in sidebar widgets.

// Add Filters
add_filter('widget_text', 'do_shortcode'); // Allow shortcodes in Dynamic Sidebar

Shortcodes in Posts/Pages will work by default if used correctly.

Where do I find this file?

I would like to have the translation button from Google Translator on the top of my site, as well on all pages, so visitors can translate all the pages if they want

If you use your shortcode like this directly into your PHP file then you don’t need my above given code.

<?php echo do_shortcode(‘[google-translator]‘); ?>

This will work no matter if do_shortcode is enabled or isn’t.

If you would like to have shortcode within widget (sidebar, footer etc) then you need to add this to functions.php which you can find in theme root folder. Appearance - Editor or via FTP.

// Add Filters
add_filter('widget_text', 'do_shortcode'); // Allow shortcodes in Dynamic Sidebar

If you can’t find functions.php file then it might not be a wise idea to touch the code at all.