Tagged: language selector, language switcher, wpml
-
AuthorPosts
-
December 13, 2013 at 8:59 pm #200076
Hello there, I would like to add the WPML Language Selector function to the social media ribbon above my main menu.
I am able to do this using the code from either of these posts: Method A or Method B.
However, neither option gives me the standard WPML format that shows up when I add WPML language selector to a sidebar menu. The main problem here is that the height of the language selector box is too tall, so it would not fit in the narrow social media nav section.
Also, in some browsers (e.g. latest version of Firefox), the language selector displays completely below the social media nav. This means that it overlaps with the main menu and is inaccessible. Please advise where I can look in the code to style the language selector.
December 16, 2013 at 8:44 am #200588Hi MHM!
Please use the method which gives you the best result and post a link to your website. We’ll investigate the css code and if possible we’ll provide some code to fix the styling issues.
Cheers!
PeterDecember 17, 2013 at 10:49 pm #201315Hi, Peter,
Unfortunately, I can’t share the link because my site is under development. Please let me know which file you’d like to review, and I’ll send you any CSS code relevant to WPML language styling.
Thanks. -MHM-December 18, 2013 at 10:26 am #201465Hey!
This makes it really difficult to give you specific instructions. A general hint would be to increase the size of the social icons: https://kriesi.at/support/topic/add-youtube-social-icon-to-header/#post-199839 – by going this way you’ll increase the height of the social icon bar and then you’ll have enough space for the dropdown.
Cheers!
PeterJanuary 4, 2014 at 12:52 am #205211This reply has been marked as private.January 4, 2014 at 6:27 am #205247Hi!
Please add this on your custom.css or Quick CSS to adjust the height then position the language selector properly:
#lang_sel_click a, #lang_sel_click a:visited { line-height: 5px; } #lang_sel_click { position: absolute; top: -10px; left: -150px; } #lang_sel_click .sub_menu li ul { top: 26px; left: 10px; border-top: none; }
Cheers!
IsmaelJanuary 6, 2014 at 5:47 pm #205900Hey, that worked! Thanks!
Just need a little help getting it styled:
* When you click the language switcher, the submenu jumps to the left. This makes it hard if you need to scroll to one of the languages toward the bottom of the list.
* I’d like to reduce the amount of space / padding above and below each language because it likewise makes the submenu longer and harder to click.
* Likewise, I’d like to reduce the amount of padding to the left and right of the language names, and maybe reduce the font by one point. The current design makes the submenu longer by pushing some of the language names to a second line.I tried adjusting some of the pixels you mentioned above but did not see any changes.
January 6, 2014 at 5:50 pm #205901Also — this one is less critical to function but does make a design impact — there are 10 px or so of white space to the left of the menu that I would like to get rid of because the background is not white. If you could help with that too, I’d appreciate it. Thanks again!
January 6, 2014 at 5:56 pm #205903Hi!
Please add following code to Quick CSS and adjust if needed
1-#top .sub_menu li ul { left: 0%; }
2-
#top .sub_menu li li a { line-height: 20px; padding: 6px 18px; }
3-
#top .sub_menu li li a { font-size: 11px; } #lang_sel_click li { width: 140px; }
4-
.header_color .sub_menu ul { background-color: inherit; }
Cheers!
YigitJanuary 6, 2014 at 6:07 pm #205907Thanks for your response, Yigit. Unfortunately, this did not make any visible changes either. It made changes to the language switcher that was in the sidebar (i.e. the default one I was replacing) rather than this custom placement one we just added.
I am going to delete that default language menu from the sidebar in favor of the one in the social media nav ribbon.
January 6, 2014 at 6:10 pm #205912Hey!
It seems like code is not being applied. You can try adding !important to all custom CSS code to force them, for example
#top .sub_menu li ul { left: 0%!important; }
Please flush browser cache and settings of caching plugin if you are using any and refresh your page a few times
Regards,
YigitJanuary 6, 2014 at 7:48 pm #205942Thanks again. Replacing all of the semicolons with !important; in the code that you and Ismael gave me has helped some. I have also tweaked the code to adjust padding, line-height, etc.
This code appears to be almost correct. However, I am still having a few problems:
- When you click the dropdown button, the first item that pops up below the current is missing its left, right and bottom borders. (Top border is set to none in the code because it would overlap with the current item’s bottom border.) There is also a weird line that is tangential to the menu (to the top right of the first dropdown item).
- The weird blank space to the left of the current item in the menu is still there. Upon closer look, I do not think it is a matter of color, so I removed the “background-color: inherit;” from the code. It appears that this one item is about 10px narrower than the rest of the items. I have tried to adjust the width, but this did not work. Trying to insert negative margin just moved the entire item, including this blank space.
Here is the code as I have revised it:
#lang_sel_click { position: absolute!important; top: -12px!important; left: -150px!important; } #lang_sel_click a, #lang_sel_click a:visited { line-height: 10px!important; } #lang_sel_click li { width: 150px!important; } #lang_sel_click .sub_menu li ul { top: 26px!important; left: 0%!important; border-top: none!important; } #top .sub_menu li ul { left: 0%!important; top: 31px!important; } #top .sub_menu li li a { line-height: 22px!important; padding: 3px 10px!important; font-size: 11px!important; border-top: none!important; }
Thanks again. Take care.
- This reply was modified 10 years, 11 months ago by MHM.
January 6, 2014 at 7:59 pm #205947One other thing: The language dropdown menu is opening upon hover. I would prefer if it only opened upon click, so that it does not pop up to obscure the main menu when a visitor accidentally moves a mouse over it. Thank you.
January 6, 2014 at 9:54 pm #205983Hi!
Please add following code to Quick CSS as well
1-#top .sub_menu li li:first-child > a { border: solid 1px #cdcdcd!important; }
2-
.header_color .sub_menu ul { background-color: #f8f8f8!important; }
3- You are going to need to hire a freelance developer for that kind of customization as it is beyond the scope of support we can provide. You can also request quote here.
Cheers!
YigitJanuary 6, 2014 at 10:23 pm #206002Thanks! I added the border you suggested to the left, right and bottom of the first item, and that looks much better. Still running into the other problems though.
Could you please take a look at my site from the private link that I posted earlier in this thread? Your second piece of code did not do anything, but don’t worry about looking at that code because the background color is not the cause of the problem. The dropdown menu is all white, so it’s not a problem that this piece of white space is there. The problem is that the border is about 10px inside of the default language item.
I also do not understand why a line is being created when you click the dropdown button. It pops up to the right of the dropdown menu just below social media navigation menu.
PS – Thank you for the advice regarding mouseover vs. click.
January 6, 2014 at 10:34 pm #206005Hi!
Please add following code to Quick CSS as well
#top .sub_menu li ul { width: 151px; } #lang_sel_click li { padding-left: 0; }
That should solve both issues. If not, please create a temporary admin login and post it here privately so we can take a look
Best regards,
YigitJanuary 6, 2014 at 10:51 pm #206008That worked! Just had to figure out one other bit of code to fix the fact that the dropdown part was one pixel to the right of the rest. I fixed it with this:
#top .sub_menu li li a { margin-left: -1px!important; }
In case anyone else is reading this because they are looking for help with a similar problem, here is the full code we used:
#lang_sel_click { position: absolute!important; top: -12px!important; left: -150px!important; } #lang_sel_click a, #lang_sel_click a:visited { line-height: 10px!important; } #lang_sel_click li { width: 150px!important; } #lang_sel_click .sub_menu li ul { top: 26px!important; left: 0%!important; border-top: none!important; } #top .sub_menu li ul { left: 0%!important; top: 31px!important; } #top .sub_menu li li a { line-height: 22px!important; padding: 3px 10px!important; font-size: 11px!important; border-top: none!important; margin-left: -1px!important; } #top .sub_menu li li:first-child > a { border-bottom: solid 1px #cdcdcd!important; border-left: solid 1px #cdcdcd!important; border-right: solid 1px #cdcdcd!important; } .header_color .sub_menu ul { background-color: #f8f8f8!important; } #top .sub_menu li ul { width: 151px!important; } #lang_sel_click li { padding-left: 0!important; }
Thanks again for all the brilliant coding help! :)
January 6, 2014 at 10:57 pm #206009 -
AuthorPosts
- The topic ‘WPML Language Selector for social nav’ is closed to new replies.