- This topic has 7 replies, 4 voices, and was last updated 3 years ago by
David.
-
AuthorPosts
-
April 13, 2019 at 6:21 am #867859
Jochen
Hi,
I am working on a multilanguage page using WPML and Elementor. Although I can have WPML add the switcher as first or last Menu-Element this is not the look that I want and does not work if set to DropDown.
I think it might be a good idea to add a widget area to the Nav area and add the swithcer there with some optical adjustments. Is there a howto to help with this?
Thx
JochenGP Premium 1.7.8April 13, 2019 at 7:37 am #867987Tom
Lead DeveloperLead DeveloperHi there,
You could register a new widget area:
add_action( 'widgets_init', function() { register_sidebar( array( 'name' => 'Your Widget Area Name', 'id' => 'your-widget-area-id', 'before_widget' => '<div>', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', ) ); } );
Then you can:
1. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook toinside_navigation
3. Add the widget area to the content:<div class="wpml-switcher"> <?php dynamic_sidebar( 'your-widget-area-id' ); ?> </div>
4. Check the Execute PHP checkbox
5. Set your Display RulesNow you can add some CSS like this:
.wpml-switcher { float: right; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 14, 2020 at 6:31 am #1194587Klaus
Hello, I have two questions: is this still the code I can use for this task and second: how do I get or set the “your-widget-area-id”? Thank you.
March 14, 2020 at 6:41 am #1194595David
StaffCustomer SupportHi there,
yes you can use this code for adding the WPML widget to the navigation.
In the first block of code, you set your own name and area-id:
'name' => 'Your Widget Area Name', 'id' => 'your-widget-area-id',
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 14, 2020 at 6:42 am #1194596Klaus
Hello again, it seems that I can have anything as “ID” here, right? My problem is, that it does not want to float right (but it stays in the navigation left), as I have “navigation as a header” floating right also.
March 14, 2020 at 6:45 am #1194600David
StaffCustomer SupportThat is correct you can put anything that in the ID as long as it is not being used by another widget area 🙂
I would do this for example:db-navigation-switcher-widget
the
db
is my initials so will reduce the chance that the ID has already been used.If you want to raise a new topic where you can privately share a link to your site i’ll take a look
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 14, 2020 at 7:03 am #1194750Klaus
Hello David, thanks for explaining. Here is my new post:
https://generatepress.com/forums/topic/wpml-language-switcher-doesn-go-to-the-right/
March 14, 2020 at 7:54 am #1194770David
StaffCustomer SupportThank you – i have replied.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.