Question : Wordpress Theme - Header Switcheroo

I've created a theme for a Wordpress site I'm developing and have installed a nifty little plugin that allows you to toggle back-and-forth with the language of the content (the plugin is called qTranslate - http://wordpress.org/extend/plugins/qtranslate/).

Anyway, the plugin works great but there are a number of things that need to be manually edited in order to get a site working seamlessly between languages.

The issue I'm having is that I need to use two different headers (in order to switch the logo image and navigation CSS sprite). In my index.php file, I am trying to figure out how to create somesort of IF statement that will toggle the "header.php" file that gets imported.

For example, by default the header.php file is loaded but if a user toggles the site language to French, I would like it to load a header_fr.php file.

With that said, I'm not entirely sure if its the best way to go about it since the function is on more pages then just the index.php file. If anyone has any suggestions, it would be much appreciated.

P.S. I tried looking through the qTranslate support forum but have issues using their search. Apparently I'm never specific enough...

Answer : Wordpress Theme - Header Switcheroo

Hi!

I think you could go like this on the top of the index.php:

if(lang == French){
    require_once("french_header.php");
}
elseif(lang == English){
    require_once("english_header.php");
}

I dont know how you define what languages is active in the database so you have to replace "lang == French and lang == English with some definition.

A more simple way is to just change the header div and use the same header.php for all languages.

if(lang == French){
    echo "
Welcome Lé French
";
}
elseif(lang == English){
    echo
Welcome you English speakin
";
}
Random Solutions  
 
programming4us programming4us