Answer the question
In order to leave comments, you need to log in
How to switch the theme on wordpress when changing the language?
Good afternoon!
I ask for help and tips. There is a simple blog, with its own simple template.
I want to make it multilingual, I used the qtranslate x plugin to switch articles to ru/en. It works great.
But there was a problem in the template on the pictures of the background, caps and various buttons, I have text in Russian. I decided to make a copy of the template, redrawn the text on the pictures, respectively, into English.
Now I have two templates ru and en
. But I don't know how to make it so that when you click on the corresponding language flag, not only the language of the articles, but also the template is switched.
In my search, I didn’t find anything worthwhile =(
Unfortunately, in WordPress, as well as in php, I don’t understand almost anything at all.
In his search, the current came to a piece of code:
<?php if(get_locale() == 'ru_RU') { ?>
здесь повидимому должна быть какая-то переключалка на мойшаблон_ru
<?php } else if(get_locale() == 'en_EN') { ?>
а здесь соответственно переключалка на мойшаблон_en
<?php } ?>
Answer the question
In order to leave comments, you need to log in
In the function.php of the current theme:
function change_theme() {
if(get_locale() == 'ru_RU')
$theme = 'twentytwelve';
else
$theme = 'twentyteleven';
return $theme;
}
add_filter('template', 'fxn_change_theme');
add_filter('option_template', 'fxn_change_theme');
add_filter('option_stylesheet', 'fxn_change_theme');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question