Support » Plugins » add qTranslate langs to header

  • Add this code to “header.php”:

      global $q_config;
      if(is_404()) $url = get_option('home'); else $url = '';
      echo '<ul id="headerMenuSystem">';
      foreach(qtrans_getSortedLanguages() as $language)
        $link = qtrans_convertURL('', $language);
        if($_SERVER["HTTPS"] == "on")
          $link = preg_replace('#^http://#','https://', $link);
        echo '<li class="menu_item"><a href="'.$link.'"';
        echo ' hreflang="'.$language.'" title="'.$q_config['language_name'][$language].'"';
        echo '><span';
        echo '>'.$q_config['language_name'][$language].'</span></a></li>';
      echo '</ul>';

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks, this helps! Can you help me with removing the bullets? I also would like to have flags (‘images’) in php? Can you help me with that as well?

    About bullets: replace “menu_item” class.
    About flags: add “img” tag before “span”.

    Thanks! I removed the bullets in my CSS with:

    #headerMenuSystem { list-style: none; }

    Do you know how to display the languages next to each other/horizontal?

    replace “ul” by “table”, “li” by “tr” and “td”

    I did it in the CSS:

    #headerMenuSystem li { float:left; width:auto; padding:0 10px 0 0; }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘add qTranslate langs to header’ is closed to new replies.