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!

5

It is possible using the template_redirect hook.

Looks something like this :

 function language_redirect()
 {
      global $q_config;

      if( $q_config['lang'] == 'en' )
      {
           include( get_template_directory() . '/page-template_en.php' );
           exit;
      }
      else
      {
           include( get_template_directory() . '/page-template_de.php' );
           exit;
      }
 }
 add_action( 'template_redirect', 'language_redirect' );

Code is untested, but should look like that.

See my similar answer HERE for more help.

Leave a Reply

Your email address will not be published. Required fields are marked *