Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to give each page a custom/different page template for every language page in WPML.

eg: Let i have a test page in English and french. Is there any way out so that in English i give sidebar template while same page in french don't have sidebar template.

Note: Solution should not be any core condition to be put in code.

Thanks in advance.

share|improve this question

2 Answers 2

You can't, unless you create your own "Page Attributes" meta box, and remove the default one.

And since a post can only have one template assigned, you'll need to create your own function that checks the page templates assigned to the current post and select the one which matches to the selected language (use a different meta key), then do your own template_redirect.

share|improve this answer

You can accomplish different sidebar content per language with either the plugin Widget Logic, or with the Dynamic Widgets plugin

Alternatively you can make different sidebar templates per language and use a conditional on the language:

if(ICL_LANGUAGE_CODE=='en'){
get_sidebar('en');
}
if(ICL_LANGUAGE_CODE=='fr'){
get_sidebar('fr');
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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