language switcher placement
-
The problem I had was how to place the language switcher (flags only) in the top-right corner of my page.
After searching this forum I found many good hints about how doing that. Anyway some didn’t work. By pure chance (I’m a newbie), it seems I’ve found some alternative solution that could be useful for others.
I’m using a child theme based on the Twenty Twelve theme.So,(as suggested by Chouby in many answers), I modified my header.php adding the following code:
<?php // outputs a flags list (without languages names) ?> <ul><?php pll_the_languages(array('show_flags'=>1,'show_names'=>0)); ?></ul>
I put above code after the
<header id="masthead" class="site-header" role="banner">
lines of the default header.php of the Twenty Twelve theme.Then, to have the right alignment, I added the following lines to the style.css file:
.lang-item { display: inline; float: right; padding:0px 5px 0px 5px; }
The suggestion I found in this forum about using
#language-switch {float: right;}
didn’t actually work for me (with the Twenty Twelve theme).
Anyway it worked if{float: right;}
was applied to the .lang-item properties rather than to the #language-switch.
The inline property is to make the flags placed horizontally rather than vertically.
I found that the padding option can be useful to give a little spacing between the flags that, otherwise, would have been crammed together.I’d like to place the language switcher on the same line of the site’s title but I don’t think that’s possible.
The result can be seen at the site I’m trying to build https://www.lucamoroni.net (very wip at the moment).Thanks to Chouby for this wonderful and effective plugin that, even if simple, let’s you control and easily customize in any way the architecture of a multilingual site.
- The topic ‘language switcher placement’ is closed to new replies.