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 <?php get_header(); ?> 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...
Who is Participating?
GodDoesntExistConnect With a Mentor Commented:

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

if(lang == French){
elseif(lang == English){

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 "<div id="french_header">Welcome Lé French</div>";
elseif(lang == English){
    echo <div id="english_header">Welcome you English speakin</div>";
AdamAuthor Commented:
Okay, so I looked into it and I think an example of that would look something like the sample below.

However, my screen is now coming up blank when I use the code. I'm not really an expert in PHP but am I missing a quote or something that would cause this to not work?

Let me know if more details are required.

   $lang = qtrans_getLanguage();
   if ($lang=="en"){
   	echo "<h1 id="logo_en">Test_EN</h1>";
   	echo "<h1 id="logo_fr">Test_FR</h1>";
<?php endif; ?>

Open in new window

AdamAuthor Commented:
I just realized that the last tag should be " ?> " and not "<?php endif; ?>".

However, I still seem to be having the same issues. Am I missing something?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.