Support » Plugin: Qtranslate Slug » [Plugin: Qtranslate Slug] qTranslate flags in header Twenty Eleven theme

  • Resolved TimoElshof

    (@timoelshof)


    I want to add the qTranslate flags to the header of my Twenty Eleven theme website: http://www.timoelshof.nl

    I know I have to add this code to the header.php file: <div class=”chooselang”> <?php echo qtrans_generateLanguageSelectCode(‘both’); ?>. The languages appear but I don’t know how to move them to the right corner of my site, probably by adding some code to my CSS (in a child theme of course).

    I have been told to modify the HTML as well but I’m a total geek. Does anybody have a solution?

    http://wordpress.org/extend/plugins/qtranslate-slug/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter TimoElshof

    (@timoelshof)

    I found it:

    Add this code to your header.php:

    <?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://&#8217;, $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>’;
    }

    echo ”;
    ?>

    Then add to CSS:

    /* flags on left side */
    #headerMenuSystem { position:absolute; top:30px; left:40px; }

    /* flags on right side */
    #headerMenuSystem { position:absolute; top:30px; right:40px; }

    Hi, I have kind of like the same problem. However, I want the flags in the navigation bar (because I have static pages and the widget won’t show up there).

    I did figure out that I can insert the flags by adding <div class=”chooselang”> <?php echo qtrans_generateLanguageSelectCode(‘image’); ?>
    in the navigation part. I also deleted the search field.

    However, the flags are neither where they should be (on the very right) nor are they centered (they’re at the very top of the black bar). How can I change their position and where? I usually figure out how to manipulate HTML but can’t really write it myself.

    Second problem I have is that when I put my mouse over the flags the language shows up (which is fine) but then there is also a small grey box hovering over the flags because that’s what happens with the navigation menu, too. Can I make that not happen for the flags?

    Third “problem”: is there a way of exchanging the flags? I would like to use round flags and for English the US flag.

    Thanks!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Qtranslate Slug] qTranslate flags in header Twenty Eleven theme’ is closed to new replies.