TL;DR: I'm looking for a way to translate only the content of a specific post in another language, not everything around said post (such as the 'meta' and the 'search' field like this solution seems to do).

Longer version: I'm currently administrating a static-HTML website for a small company that gets updated every few weeks with a new post. Some of these posts are written in French (default language) and English, some also in German, or even Spanish. Currently, every version of every post loads at first, while all non-French versions are hidden by display:none. Each post has a number of flags to its right, which correspond to the available translations. The user clicks on one of these flags, and with a little jquery magic, the display property gets switched accordingly, replacing the content of the post with its localized counterpart. Easy.

I'm now trying to port all this to wordpress, such as to hand the administration of the website to someone else, who can potentially be totally computer-illiterate. I'm desperately trying to find an elegant solution, that's both light on code, and easy for some editor to figure out. If anyone has an idea I could dig into, that would be much appreciated.

P.S.: it's important to note that we don't care about SEO, for the specific nature of our business doesn't demand it.


1 Answer 1


The easiest approach would be to have custom fields on the edit page: one text field for every language you want to use (and perhaps different title fields?) For this you could use a plugin like ACF. This would provide an easy interface for non-tech editors.

Supposing you are building your own theme you can integrate the custom fields in your template. Always display the French text, test if fields for other languages are empty and if not include them as well. Then toggle with jQuery like you're used to.

If you are using a third party theme, you would have to build a child theme with a filter in functions.php that adds the custom fields to a normal call to the_content (and the_title) and includes the css and jQuery for toggling the display. Like this:

$spanish_content = '<div class="spanish">' . get_field('spanish_content') . '</div>';

(note: the get_field call is specific to the ACF plugin)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.