How to implement Language Switcher in WordPress?

Home Forums WordPress Plugins Language Switcher How to implement Language Switcher in WordPress?

Viewing 0 reply threads
  • Author
    Posts
    • #7646
      Rafasashi
      Keymaster

      The Language Switcher allows you to add dropdown list of urls pointing to a translated version of the current page. This plugin do not provide translation features or multi-version like WPML or Weglot.

      You can totally use it together with WPML or Weglot however we strongly recommend you to keep all languages separated from each other by simply implementing one WP site per language and use the language switcher as navigation tool between all the installations, like wikipedia does in its sidebar.

      If you chose to implement multi-language from the same site without any other translation plugin the plugin will take care of switching the default language of the site depending on the language of the current url. It means that when you will be reading the spanish version for example, the auto generated contents (date, plugin translations, core translations…) will also be shown in spanish. Following the same logic the Menu will filter only the spanish urls and the WP_Query will show only spanish contents in the case tag clouds and list of categories.

      Once you activate the post types (post, page, product….) and/or taxonomies (tag, category, attribute…) in the Language settings you can then add language urls when editing the content.

      There is 3 ways to integrate the switcher in your site.

      1 – If you need to add the language switcher in your site you can use the widget or the shortcode [language-switcher].

      The shortcode also works inside post contents if you need to show the switcher only for some pages.

      2 – To add the languages in your menu you can check the menus from the backend in Languages > Settings > Show in Navigation Menus

      3 – To add the shortcode directly in your theme you can use the following PHP code:

      <?php echo do_shortcode('[language-switcher]'); ?>

      The switcher do not provide a CSS customizer but you can easily play with the classes to customize the design from your theme css.

Viewing 0 reply threads
  • The topic ‘How to implement Language Switcher in WordPress?’ is closed to new replies.