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.

This topic contains 17 replies, has 3 voices.

Last updated by Sean 6 years, 7 months ago.

Assigned support staff: sarah.n.

Author Posts
March 18, 2013 at 9:09 am #112350

OlivierL

Hi, there
I saw that WPML was 100% compatible with Alterna so I switched to that template to solve my issues. Would you be able to guide me where to drop exactly the code to get my drop down switcher in the header (this code <?php do_action('icl_language_selector'); ?>).

Your colleague did it for me in the previous template Deep Focus from Elegant Themes but I had to move away from it due to compatibility issues.

Thanks for your help,
Olivier

PS - website is hidden link

March 18, 2013 at 9:32 am #112356

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Hello Olivier,

Where exactly in the header do you want the language switcher to display?

Do you happen to have a widget ready section where you want to display it?

Can you provide your header.php template in http://www.pastebin.com/ for me to see?

Thank you.

March 18, 2013 at 9:39 am #112359

OlivierL

Hi , Sarah

I want to have it display on the right side of the header at the level of the logo
I didn't create any "widget ready section" - really newbbie, not a web designer.
I don't think that Alterna has a widget ready for header, only for sidebar and footer I believe.

Here is the link for my header.php : http://pastebin.com/KQJbiSFF

Thanks by advance for your help,
Olivier

March 18, 2013 at 9:56 am #112364

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Thank you for getting back to me Eric.

Add <?php do_action('icl_language_selector'); ?> right after the logo div like this:

<div class="logo">
<a href="<?php echo home_url(); ?>" title="<?php bloginfo('name'); ?>"><?php if(alterna_get_options_key('logo-txt-enable')  == "yes") echo '<h2>'.get_bloginfo( 'name' ).'</h2>'; ?></a>
</div>
<?php do_action('icl_language_selector'); ?>

Once this is done left me know so I can give you the css for it that will position it to the right.

March 18, 2013 at 12:13 pm #112421

OlivierL

Hi, sarah

Thank you for such a quick reply. Just did it but 2 things happen :
1- The switcher is too much stuck to the logo - i'd like preferably to the right (or centered if right is not possible).
2- The drop down function doesn't work - nothing drops 🙂

Can you explain me what's the issue here ?

Thx by advance - i appreciate your support on this
Olivier

March 18, 2013 at 12:22 pm #112426

OlivierL

ok now the drop down works - just need to be at the right place to the right 🙂

March 18, 2013 at 12:32 pm #112430

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Olivier,

Yes well, this is why I said that after you add the code we will need to adjust the css to position it where you need it to display 🙂

Please add the following under "WPML -> Languages -> Languages Switcher Options -> Additional CSS"

#lang_sel {float: right;}

This will position the selector to the right.

March 18, 2013 at 12:39 pm #112436

OlivierL

Sarah,
sorry was impatient to see it working again - lost weeks of leads because of the compatibility issues - so perfect now it's at the correct place but I talked too fast - issue#1 doesn't seem solved.
When I hover over the switcher, it doesn't display the drop down with other 2 languages 🙁

March 19, 2013 at 7:00 am #112729

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Olivier,

When I attempted to visit your site again I just get a white screen.

Because of this I cannot check the language switcher source code however according to what I recall from seeing yesterday, the alternative languages did not even display in the drop down which tells me that the content is not ready in those languages yet.

Is the front-page translated already?

March 19, 2013 at 11:34 am #112929

OlivierL

Hi Sarah

I know - incredible ! someone got into my back office and deleted my template 🙁
I changed all passwords and bought some extra security plug-ins.
To answer your question , no I haven't translated the front-page and I see that the issue comes from that. So i will get on with that first and check

March 19, 2013 at 11:52 am #112939

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

OK, I will be here when you need me again.

March 19, 2013 at 1:10 pm #113011

OlivierL

OK sarah

The language switcher is back and working - it doesn't work on Home page indeed because of the trasnlations needed to be made.

I have tried to synchronize the menus as well because when I go on a german page, the nav bar remains in english ?? but when I tried in "WP Menus Synch" to select all and apply, I get this error message : hidden link

What is that?

March 20, 2013 at 12:17 am #113276

Sean

Hi Sarah, actually I have the same issue, could you provide some help for me on this as well? My site is hidden link, I'd like to place the language switcher either above or below the search bar on the right, and I tried to place the <?php do_action('icl_language_selector'); ?> code in many places under Header but still couldnt get it right....

Thank you!!

March 20, 2013 at 6:56 am #113292

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

@olivier, Can you please confirm that you are using the latest version of WPML and its active add-ons?

You can check the latest released versions under "My Account -> Downloads" on this site. If you need to update, instructions to update can be found here: http://wpml.org/faq/install-wpml/#2 Only make sure you backup your database first before you proceed! You can use a plugin for this if you like such as: http://wordpress.org/extend/plugins/wp-db-backup/

@sean, a quick look through Firebug shows these elements to the right:

<div class="header_right">
<div class="header_contacts clearfix"><!-- contact contents here --></div>
<div class="header_soc_search clearfix"><!-- social and search contents here--></div>
</div>

If you want the language switcher to display below the search area then simply add <?php do_action('icl_language_selector'); ?> below the header_soc_search div but still inside the header_right div like this:

<div class="header_right">
<div class="header_contacts clearfix"><!-- contact contents here --></div>
<div class="header_soc_search clearfix"><!-- social and search contents here--></div>
<?php do_action('icl_language_selector'); ?>
</div>

If you still find it difficult can you provide your header.php template in http://www.pastebin.com/ for me?

Thank you.

March 21, 2013 at 2:07 am #113622

Sean

hi Sarah thank you for your help on this. I tried to add the code in as described but it appears in the center of the header which look a bit awkward (image attached). I pasted the code on pastebin without the language switcher code: http://pastebin.com/0g8vuVZZ

thank you!

The topic ‘[Closed] Integrating language switcher in Alterna template’ is closed to new replies.