Translation with WordPress Pods and WPML

Client
  • Omitsis
Technologies
Services
Date
  • 24/01/2020

Plugins incompatible with WPML

Sometimes we encounter WordPress sites that have been built using plugins for content creation, blocks, etc., which are not compatible with site translators, such as WPML. This poses no problem while the site is in a single language, but if multiple languages are needed, we face a complicated situation, at least in terms of time cost.

There are three solutions, but not all always work.

  1. Simple and quick solution presented in this post.
  2. Rebuild the site using plugins that are compatible with WPML.
  3. Create a MultiSite setup and use MultilingualPress.

1. Simple and quick solution

We explain it below: if plugins are used for developing a WordPress solution that are not compatible with WPML, for example PODS, an interesting solution is to duplicate the same post or content type, which has been created with elements from the incompatible plugin, and use each version for each of the languages configured for the site, differentiating each post with a naming convention, for example with the language abbreviation (_en, _es, _fr) in the slug or (-EN, -ES, -FR) in the name.

Then, to let WordPress know which of these blocks or contents belongs to a specific language, we use the constant ICL_LANGUAGE_CODE, defined by WPML. This can be used as part of our theme to call the content of a post depending on the current language being viewed, stored in the mentioned constant.

For example:

1<?php if (ICL_LANGUAGE_CODE == 'en') { ?>

…the content in English is displayed

1<?php } else { ?>

…the content in a language other than English is displayed

1<?php }?>

2. Rebuild the site using plugins compatible with WPML

This solution will take more time: the site must be reviewed to see where the plugin is used, which blocks and contents are affected, and the work must be redone. It is like a refactoring process, which can take more or less time, but will always be a significant time investment, possibly approaching the total web development time. If the person building the site must use a plugin they are unfamiliar with, the learning curve adds extra time. Usually, the original builder used the incompatible plugin because they already mastered it over alternatives.

3. Create a MultiSite setup and use MultilingualPress

JU

julia

manager

Recent Posts