Home›Support›English Support›[Resolved] Place a custom language switcher in header (made with Divi Theme Builder)
[Resolved] Place a custom language switcher in header (made with Divi Theme Builder)
This thread is resolved. Here is a description of the problem and solution.
Problem:
I would like to place a custom language switcher in the top right corner of the header (I have 1 global header and 2 custom headers made with Divi Theme Builder)
Solution:
Place the custom language switcher shortcode [wpml_language_selector_widget] in the Divi code module in the global header made with Divi builder.
That shortcode outputs the language switcher based on the options set in the Custom Language Switchers section.
Hi, I would like to place a custom language switcher in the top right corner of the header (I have 1 global header and 2 custom headers made with Divi Theme Builder). See image attached, made in Photoshop.
Is there any documentation that you are following? I tried to put the shortcode [wpml_language_selector_widget] in a code module inside the header but then I couldn't get to have a transparent background, and in the widget language switcher settings I had to choose the place where I wanted to put it, but there was only "sidebar" or "Footer#1...#6".
I also wanted to try twig template but then I saw the message on top of the article saying that this method was being deprecated and that I should not use it.
I didn't try the PHP method because I have not enough knowledge in PHP.
Is there a similar example that we can see? See image below
What is the link to your site? hidden link
username : ****
pass : ****
I hope there's a simple way to do this, because all the documentation I read so far make it look like a really complicated task !
I think adding a language switcher shortcode would be the best approach. That shortcode outputs the language switcher based on the options set in the Custom Language Switchers section.
If you want to use the [wpml_language_selector_widget] shortcode, you must first enable the Custom language switcher option on the WPML → Languages page. Then click "Customize" just under the Enable button and adjust your style.
If you still have an issue with setting transparent background, that there is probably some other style CSS code adding a white background to the switcher. Share with me a URL where I can see it, and I will check the CSS code and try to provide a fix for a background.
Please note to achieve the effect you shared in your image (underline efect etc) you might need some more complex CSS custom programming, which is a bit out of the scope of our work.
I managed to place the custom language switcher's shortcode in a code module on top of the global header made in Divi Builder see image below) but I didn't succeed in putting it directly inside the header (like the example in my first post). I still have an issue with the spacing of this module, but I know that it can be solved with some custom CSS.
I will contact the Divi support to zsk them if it's possible to place the language switcher inside the header, but before that, I have one last question for you : does this custom language switcher always has to be fullwidth or is there a way to set a fixed width or some custom right and left margins ?
I think this is excepted since you are adding a new module, so it will need some custom CSS to move around and set this module transparent, and to appear as on your design. If you can share the link to check the site, I can take a look, otherwise, I advise hiring a developer to write some CSS code so it appears as in your design.
Does this custom language switcher always has to be fullwidth or is there a way to set a fixed width or some custom right and left margins ?
I think this is up to Divi builder settings, layout, if you have put code module inside fullwidth row/column it will appear like that. You will probably have to create different layout/columns inside that 1 row or inner rows. I would advise checking Divi documentation and how to set up the correct layout, overlap row etc:
- hidden link
- hidden link
- hidden link
I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you.
Hi Drazen, I finally got to achieve what I wanted 🙂
I was not using the right Divi module for the header : now I'm using a row with 3 columns, and in the right column I put a code module with the language switcher shortcode (and the background is transparent now).
Thank you very much again for your help !
Regards,
Caroline
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.