I am trying to make a site with two languages. I was looking for a solution and didn't find a simple how-to answer. Also, I prefer not to use plugins when it is possible.

What I'm trying to do:

1) To have a domain.com/en and domain.com/ru while default redirect is at domain.com/en.

2) One WP engine install, same admin panel with same language - English.

3) Free way of styling things(this include html too, not only css). This is the most problematic part of course.

I can't figure out how to make this. I know there is a way to call different headers and footers, but I don't know how to manage this effectively with two languages site. I can use for example different categories for different languages, but is this good practice and is this going to work properly?

  • Your question is not code bug. It's a suggestion. Better to ask in WordPress.org. and did you try any plugins qTranslate and few more plugins available which can help you to make your wp Multilanguage.
    – Kvvaradha
    Nov 29, 2015 at 17:27
  • As I mentioned above, I prefer not to use plugins. This is not suggestion, but a question of how-to. But thank you for trying to help me
    – piot3rs
    Nov 29, 2015 at 17:35
  • What you are asking is an big thing. You should learn about. PO and. MO files than you have to create one more tab on post editor page. And use tinymce editor with your custom language.
    – Kvvaradha
    Nov 30, 2015 at 1:38

2 Answers 2


You can use below code for translating strings:

add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');

function translate_text($translated) { 
    $translated = str_ireplace('Choose an option', 'Select', $translated); 
    $translated = str_ireplace('Original Text', 'Your Replacment Text', $translated); 
return $translated; 

But I have no idea for translating complex contents. I know you don't want to use plugins but as my research, we must write php code very heavy as a plugin to work. I recommend WPGLOBUS, It create an icon for every post or page field like title, content or categoris and more, while you click on the icon you can enter your translation for unlimited number of languagess which you set before in the settings, plugin generates an yoursite.com/ru address without generate or need to any new stylesheet, js or pages or load any additional file.

  • Thank you, but this is not what I'm looking for
    – piot3rs
    Nov 30, 2015 at 1:34

Here's a simple (so, not exhaustive) how to:

  1. Make two custom post types, 'en' and 'ru'. This will make sure all your posts will have urls www.example.com/en/post-slug and www.example.com/ru/post-slug

  2. Make .po and .mo files for both languages (or only for russian if english is already the default language for your theme)

  3. In your functions.php make sure the right textdomain is loaded by using the locale filter based on the post type:

    add_filter( 'locale', 'wpse210218_set_locale' ); function wpse210218_set_locale ($lang) { if ( 'ru' == get_post_type() ) { return 'ru_RU'; } else { return 'en_EN'; } }

As for html and css, you can have different templates for different post types, so that is easily solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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