Skip Navigation

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 7 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 9 months ago.

Assisted by: Nicolas V..

Author Posts
June 12, 2023 at 11:12 am #13809059

evaK-2

Hello,

So i have a webshop with 4 languages, NL (default language), EN, FR and DE. Everything worked correctly, i saw the language switcher on all 4 "sites". I could switch between the languages. But last week (5 june - 11 june) the switcher on the De site was gone and replaced by the shortcode. I did some investigation and debugging but i did not find any thing that could lead to this change. I personally did not edit anything, it just happened so suddenly. and it is only happened on the De navigation. It worked correctly for months. The only thing that was weird was that also last week our filter in woocommerce (we use the YITH woocommerce filter) did not have any styling anymore. I checked to disable the filter plugin but this was not the issue. I'm out of solutions. I included 2 screenshots, 1 of the NL navigation (the default language) and then the DE navigation where you can see the shortcode.

moens-nl.png
moens-de.png
June 12, 2023 at 3:39 pm #13811139

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Welcome to the WPML support forum. I visited your website and looking at the source code I can see that the shortcode in German is inside a paragraph tag:

<p>[wpml_language_selector_widget]</p>

That's why it's interpreted as "text".

I'm not sure what could have created this issue in the first place but you can try to make a small edit on your original header (like adding a space in the title or change some settings) in order to be able to "update it". This should trigger an "update needed" on your translations, then you can enter the German translation and complete it to see if the code gets corrected.

Or try to add this shortcode inside a shortcode block/widget to be sure it will be interpreted as a shortcode and not a paragraph. Same thing, do it on your original language, save/update and then re-validate your translations.

June 22, 2023 at 2:50 pm #13878761

evaK-2

Hello,

Sorry for the huge delay!

Oké i will check if i can update the navigation by making a small change. If it doesn't help i will look to add the shortcode again. But if that still does not help then i will look for other possible solutions. At this moment i still don't know what happened exactly.

June 23, 2023 at 6:32 am #13881855

evaK-2

Hello,

I have added the shortcode using Jquery an PHP, and this worked. the only thing that is not working are the URL's. these are not generated, i cannot switch to linked pages on the DE site.

So in the uploaded image you can see that you are on the IBC product category page which has the url 'hidden link'. But when you look in HTML you can see that the URL's of NL, FR and EN are updated with the correct linked page?

moens-ibc.png
June 23, 2023 at 12:57 pm #13884591

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Yes, adding the shortcode with PHP is a great solution.

I went on the link you shared and in the source code I can see all the correct URLs added as hreflang:

<link rel="alternate" hreflang="nl" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="de" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />

Usually, when the language switcher acts strangely it's either a caching issue or a low PHP memory allocation.
1. I see in your debug info file "1024MB" but it should be "1024M". Did you change it yourself in your wp-config.php file? If so, the code should be:

/* Memory Limit */
define( 'WP_MEMORY_LIMIT', '1024M' );

2. But I would still think it's more likely to be the cache because if I go on the NL version of that page, the language switcher works properly. And if I go to the FR version, then I can see 2 switchers! Probably the old one (shortcode) and the new one (PHP).
Could you please try to purge your cache? Maybe resave the header translations too.

Please let me know if one of those 2 solutions resolve the issue.

June 30, 2023 at 6:05 am #13920883
evaK-2

Hello,

I made it work, the correct URL's are now filled in the href. And on the FR site the second language switcher has been removed. I also changed the memory limit to '1024M' instead of '1024MB'

Thanks for resolving this issue!

However, we have quite a few problems that appeared out of nowhere. For example when you use the search function (implemented using Ivory search) on EN, FR and DE, then the navigation and footer are missing on those search pages. Secondly but this is in the admin panel. If i want to change the navigation of EN, FR or DE then i cannot find it anywhere. I am using the editor in WordPress. But it is not only the navigation, all the templates of that particular language are gone. i always get to see the default one's of NL. I am not sure where those templates are, because they are still loading in, but i cannot edit them anymore. That is why i used jQuery to add the language switcher on DE.

New threads created by Nicolas V. and linked to this one are listed below:

https://wpml.org/forums/topic/split-shortcode-is-shown-in-de-navigation-instead-of-switcher/

June 30, 2023 at 6:11 am #13920885

evaK-2

I have created 4 different templates for the navigation and footer, that could be the issue? If this is, then is there a way to fix this so that there is only 1 template for the navigation and footer? And then using WPML for the translations?

July 1, 2023 at 5:12 pm #13927883

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Glad to hear that it now works.

As the original issue is resolved and since we limit one issue per ticket, I have opened a new ticket for your additional question that's needs a little more of debugging and investigation. Let's continue our conversation on that new ticket: https://wpml.org/forums/topic/split-shortcode-is-shown-in-de-navigation-instead-of-switcher/

Keeping one issue by forum threat helps to keep the forum clean and organized, it will also help other users with similar problems to find solutions when searching the forum.
Thanks for your understanding.

Nico