• magicsun

    (@magicsun)


    I myself was in need of a fix to change meta data for each language, for the whole site and also using the qTranslate plugin. Since I use this for my personal portfolio site only, I don’t need variable meta data for each page, but only for each language.

    If you are also looking for something like this, do the following.

    Add the following code in your header.php (between your head tags). It’s a replacement for the excisting meta keywords and description tag.

    <?php
    $lang = qtrans_getLanguage();
    if( $lang == "nl" || $lang == "")
    {
      echo '<meta name="Keywords" content="dutch keywords here" />';
      echo '<meta name="Description" content="dutch description here" />';
    }
    elseif( $lang == "en")
    {
      echo '<meta name="Keywords" content="english keywords here" />';
      echo '<meta name="Description" content="english description here" />';
    }
    ?>

    In my example the dutch and english language is used, but you can change the variables to your own languages. I’m not a php person, I just put together different codes i’ve found on the web, and it did what it needs to do. (just keep that in mind, lol)

    If you have a more cleaned up version of it, or you see some mistakes, feel free to post them.

    I just thought of sharing it here, since i’ve spend 3 days searching for it, and maybe someone is in the same situation as I was before =)

    The reason I wanted this is because I often use facebook, and when I plug my site on it, the dutch description kept popping up. I didn’t wanted that, because when I post the english version of the site, I want also english text to show. So voila, there ya go.

    Regards,
    Mirna

  • The topic ‘[Plugin: qTranslate] Change meta data for different language FIX’ is closed to new replies.