Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem: The links added to some new strings are not pointing to the right language. They stay the same when changing the language while they should have the /?lang=it at the end. Solution: The solution is to use a filter hook. Relevant Documentation: https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/hard-coded-theme-links/

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

Last updated by charleneR-2 2 years, 1 month ago.

Assigned support staff: Radu.

Author Posts
February 8, 2019 at 11:22 pm #3177309

charleneR-2

Tell us what you are trying to do?
I added localized strings in the header and footer of my site. After scanning for strings they show up in the "String Translation" editor. The replacement translations have been saved for all three languages. However, these strings are the major links to pages in the site. When rolling over them the link the browser shows they will be going to look correct, however the page that gets opened is the English page and not the matching page for that language.
Is there any documentation that you are following?
I could not find documentation for this.
Is there a similar example that we can see?
Yes, go to hidden link and switch to any of the available languages from the home page. Then click any one of the four top links in the top left of the page in the header. The end part of the link is not being added to the link. For example, /?lang=it I can't find where I can fix that.
What is the link to your site?

Screen Shot 2019-02-08 at 3.20.03 PM.jpg
February 11, 2019 at 11:56 am #3182693

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Charlene,

You said that you added some links to the header and footer. Are they hard-coded? If yes, then please have a look at this article: https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/hard-coded-theme-links/ Basically, you should use this hook when adding the links: https://wpml.org/wpml-hook/wpml_element_link/. Can you give this a try and tell me how things work after the change, please?

Regards,
Radu

February 21, 2019 at 6:52 pm #3229576

charleneR-2

My issue is resolved now. Thank you!