I have two page templates and Qtranslate installed.
I want to choose one or another depending the language selected.
Can I do something like this ?
if($q_config['lang'] == 'en'){
// load page-template_en.php
}else{
// load page-template_de.php
}
Any idea ?
Thanks!
It is possible using the
template_redirect
hook.Looks something like this :
Code is untested, but should look like that.
See my similar answer HERE for more help.
Finally found it!
If I understand your question right, the template is basically saved as metadata that needs to be updated.
Source and further info
The best (canonical) way is use
template_include
hook: http://codex.wordpress.org/Plugin_API/Filter_Reference/template_includeExample code:
Should be possible using the
template_include
hook. Code is untested:Thank you everyone for these suggestions !
I wanted to set “Elementor canvas” template by default on post only and I did like that :