How to put language switcher into header image? (18 posts)

  1. mpek
    Posted 1 year ago #


    I would like to put the language switcher over the header image or if that doesn't work just below that, how do I do that? My them doesn't have a sidebar...


  2. ibaan
    Posted 1 year ago #

    Hi mpek,
    I have found a work around, but I would like to have a good fix of this as well!
    The point is that with this solution you go back to the home page, not very elegant, but probably used is 90% of the cases anyway:


  3. mpek
    Posted 1 year ago #

    but most of the time you switch once, have a look around and read what you like, if at all the sidebar or the footer can offer the switcher-widget for later usage...what is your workaround?

  4. ibaan
    Posted 1 year ago #

    i just found a better solution!
    you can enter '<?php qtrans_generateLanguageSelectCode(); ?>' where you want it.
    than when you need flags go to the language in admin and change the name into '<img src=http://www.ambis.nl/wp-content/plugins/qtranslate/flags/nl.png>'

  5. wimmerstefan
    Posted 1 year ago #

    You better change your link to 'mqtranslate' ... ;-)

  6. dodoland
    Posted 1 year ago #

    it's a great solution!
    but i don't got it how can i change text with flags...
    and how can I change the formatting? with php code that creates a list in vertical, i need an horizontal choice
    thank you

  7. ibaan
    Posted 1 year ago #

    for flag you go here: wp-admin/options-general.php?page=mqtranslate&edit=en
    and change the name 'english' to
    <img src=http://www.ambis.nl/wp-content/plugins/mqtranslate/flags/gb.png>

    for the horizontal you have to change the css file in your theme folder...
    depends a lot on your theme how to do that.

    good luck

  8. ninostar78
    Posted 1 year ago #

    I tried to add dropdown language selection with '<?php qtrans_generateLanguageSelectCode(); ?>' but that doesn't work when I add it into page/post...

  9. BigMacOnTrack
    Posted 1 year ago #

    Ive explored the link http://wordpress.org/support/topic/qtranslate-how-to-add-language-switcher-button-in-menu-bar but that only works for that one specific theme.

    Where is it that you can add '<?php qtrans_generateLanguageSelectCode(); ?>', do I still need to change anything within that code to get it to do something? Thanks for any help

  10. ibaan
    Posted 1 year ago #

    you can add it f.e. in your header.php from the theme.
    but you can add it where you want. http://www.ambis.nl/

  11. bashirloic
    Posted 1 year ago #

    Hi Guys,
    I've installed Mqtranslate and i'm trying to get the widget in my header just above or below my social media icons.
    I have extremely limited knowledge of coding and rely on advice from thread like this to achieve what i'm looking for.
    I currently have the widget in my sidebar, the flags are quite small compared to what i want them to look like.
    So, i tried pasting the following code in my header.php file :
    '<?php qtrans_generateLanguageSelectCode(); ?>

    what i got was text to the left of the screen. I can't seem to understand how to make the text an image as explained above.
    I would like the two flags (english and frecnh) to appear above or below the social media icons that are to the right of my header.
    I tried some CSS but didn't manage to do it.
    Some help anyone?

    here is my blog: http://www.easywayabroad.com

    Thanks :)

  12. lacoachdesfinances
    Posted 1 year ago #

    By looking at your blog, you seem to have succeeded. How did you achieve this as I am also looking to put my two flags at the top like you did. I also have very limited coding knowledge, but I can follow instructins very well :)

  13. bashirloic
    Posted 1 year ago #

    Yes i finally managed to do it. It's not that hard really.
    What i did was paste the code that generates the widget in the header php. file.
    Then use CSS to place it where i needed. Here is the custom CSS i used.
    I then uploaded new flags to the plugin directory.
    So step by step:

    Paste this code to your header php file:
    <?php qtrans_generateLanguageSelectCode('image'); ?>

    Then depending on the theme your using, paste the CSS in the custom CSS field:
    Play around with positioning to put it where you want.

    If you need to upload new flags, just use something like filezilla or similar to access the files on your server. go to the plugin directory then the directory for that particular plugin. There is a folder called "flags" upload your custom flags here. Don't forget to rename them so they replace the flag you want to change.

    /*CSS for Flags */
    .qtrans_language_chooser li { display: inline;
    float: right;
    position: relative;
    top: 20px;
    right: auto;
    left: auto;
    margin-right: 10px; padding: 0; }
    .qtrans_flag { margin-left: 10px; margin-top: 0px }
    width: 45px !important;
    height: 30px !important;
    background-size: 45px 30px !important;}

  14. A Silva
    Posted 1 year ago #

    Hi bashirloic,

    Thanks for the information. That was very helpfull. I was wondering where you got that widget code from? (<?php qtrans_generateLanguageSelectCode('image'); ?>)

    I now have another problem. The flags appear on the right side. Very good! But when I take a look at the site on my mobile phone than it there is a strange white space on the right side. I want to position the flags in such a way that i looks better.

    Take a look at http://www.cabo-ip.com

  15. bashirloic
    Posted 1 year ago #

    Hi A Silva, i had a look at your website and i think i see what you mean. You'd like the flags to be more alined with the menu when you view your website on a mobile phone?
    If so, i'm not sure i can help much, it maybe depends on if your theme is a dynamic theme. Or otherwise it's just something to do with the CSS. Try playing around with different position types to see which one best suites what you want to achieve.
    check out this website to learn some CSS tricks, thats how i did it.

    For the widget code, i juste found it on a similar forum, as well as the CSS. I just changed a few lines so that it looked like what i was looking for.

  16. adminlogic
    Posted 8 months ago #

    Solution I found work perfectly for me, you guys can try

    Write just under <body> Tag >>
    <div id="lang_bar_nav">
    <?php echo $lang = qtrans_generateLanguageSelectCode('image'); ?>

    Write in style.css
    #lang_bar_nav li {
    display: inline-block;
    list-style-type: none;
    padding-right: 5px;

  17. sharehelp
    Posted 6 months ago #

    Dear, bashirloic

    I saw your website succeeded, and I want my all homepage change language as yours when i click other flag language.

    But i dont know how to do it?
    Could you please help me? i'm good for your instruction

  18. sharehelp
    Posted 6 months ago #

    Anyone can help me please?
    Thanks in advance :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.