How to put language switcher into header image?
-
Hello,
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…
-
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: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?
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=https://www.ambis.nl/wp-content/plugins/qtranslate/flags/nl.png>’You better change your link to ‘mqtranslate’ … ??
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 youfor flag you go here: wp-admin/options-general.php?page=mqtranslate&edit=en
and change the name ‘english’ to
<img src=https://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
I tried to add dropdown language selection with ‘<?php qtrans_generateLanguageSelectCode(); ?>’ but that doesn’t work when I add it into page/post…
Ive explored the link https://www.ads-software.com/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
you can add it f.e. in your header.php from the theme.
but you can add it where you want. https://www.ambis.nl/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: https://www.easywayabroad.com
Thanks ??
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 ??
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 }
/*———————————–*/
.qtrans_flag{
width: 45px !important;
height: 30px !important;
background-size: 45px 30px !important;}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 https://www.cabo-ip.com
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.
https://www.w3schools.com/css/
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.
??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’); ?>
</div>Write in style.css
#lang_bar_nav{
text-align:right;
}
#lang_bar_nav li {
display: inline-block;
list-style-type: none;
padding-right: 5px;
}
- The topic ‘How to put language switcher into header image?’ is closed to new replies.