[Resolved] Replicate WPML Website Language Switcher
This thread is resolved. Here is a description of the problem and solution.
Problem: The client wants to replicate the WPML Website Language Switcher styling and behavior on their website, specifically addressing the issue of excessive space on the right of the flags in the language switcher. Solution: We recommended the client to apply custom CSS to adjust the styling of the language switcher. Here are the steps and the code provided:
If this solution does not resolve your issue or seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am trying to replicate the WPML Website Language Switcher on my website hidden link. I have been looking at various resources on the WPML website to achieve this.
Symptoms:
The Language Switcher have by default a huge space on the right of the flags. I'd like to replicate (exactly) the WPML Website Language Switcher styling and behaviour for all Language Switchers on my website. Also for the foother, to be added to my Pro Theme (Cornerstone) Footer on my website. Your Language Switchers are the most stylish!
Questions:
How can I replicate the WPML Website Language Switcher on my website? Both for Header, Footer and Custom Language Switchers.
Thanks for contacting us. I’ve checked your website, and it appears to be in maintenance mode. However, I noticed that a dropdown language switcher is displayed.
You can customize its appearance using custom CSS. To do so, navigate to Appearance > Customize > Additional CSS in your WordPress dashboard and insert the following code:
Let me know if you need help with the specific CSS code or design.
DISCLAIMER: Please know that any snippet or code suggested here is for educational purposes only. they are not meant to be the final solution but instead meant to point you in the right direction and are out of the scope of our support so we can't nor will modify, improve, debug or maintain it.
I normally use a very light gray. It was more to know if I can still use that customiser, or if using the CSS wil invalidate the colors chosen at the customiser.
I'd like to be able to select on the customiser for sure.
Thanks for your reply. You can try to use the customizer. If it's not working, then you can use the custom CSS code that I've shared. Add the code at the end.
I've noted as you can see by the screenshot below, that the secondary language flag is a bit dislocated to the left, not being exactly in the center like on the WPML Website.
Would be possible to update that CSS in order to achieve the centered secondary flags?
I'll keep looking forward from you on that, thank you very much.
Thanks for your reply. The custom CSS code should reflect the language switcher styling on your Website, no matter where you display it. Please add this custom CSS code to fix the alignment issue.
.wpml-ls-legacy-dropdown .wpml-ls-sub-menu a {
margin:0 auto;
text-align:center;
}
Worked like a charm. The first (Comming Soon) page is already online and translated on the 4 languages, all perfect. Thank you so much.
I'll now create a first page with Header & Footer, to check the visual glitches I've had before restarting the site from scratch. But that's another ticket.
Thank you very very much once more for your always good will to help.
All my best regards to you and all the Staff & Dev Team!