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

Last updated by Bruno Kos 1 week, 5 days ago.

Assigned support staff: Bruno Kos.

Author Posts
October 2, 2019 at 11:14 am #4679597

christianA-18

Hi.

I'm building a site in norwegian and english. This is basically a one-pager, and I'm using css id on sections for scrolling down to specific content clicking the menu items.

I've used the same id's for the english menu items (and also tried differient id's for the two languages), and it works fine when on the english frontpage. But when on eg the english shop-page – and clicking eg "Contact" in the menu on top – I'm sent to the norwegian frontpage (and the norwegian contact-section).

How can I make this work as expected? So I'm sent to the corresponding language.

Another problem that I think is related. I'm using the url "hidden link" for adding a product to the cart and beeing sent directly to the checkout. Which url should I use for the english version? So I'm sent to the english checkout. It's used eg for the button on top "Legg i handlekurven".

Look forward to hear from you.

Regards Christian.

October 2, 2019 at 12:24 pm #4680105

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you tell me if you tried translating menus - synchronizing them? Because generally when you translate the page, ID anchors will remain the same on those translated pages, because CSS ID will not be translatable in most cases and is not recommended at all, as it may interfere with generated CSS styles, based on those IDs.

Regards,
Bruno Kos

October 2, 2019 at 12:49 pm #4680243

christianA-18

Hi.

If I understand you corect. I've build the new english menu making items with custom links (with ancors) – and the same anchors as the norwegian menu. The english frontpage has the same anchors (id's) as the norwegian frontpage.

October 2, 2019 at 12:59 pm #4680321

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Yes, that's correct, anchor IDs should remain the same in both languages and it is not advisable to translate them. Most visual builder dynamically create IDs based on row IDs you set in the original language.

Regards,
Bruno Kos

October 2, 2019 at 1:06 pm #4680363

christianA-18

Hi,

Ok, but how can I make this work? When on a norwegian different page than the frontpage I can use eg this url for the contact section; hidden link

Is there a different url for the english section I can use? The id is the same. What about the "/?lang=en" somehow? I cant find a way to include this.

Regards.

October 2, 2019 at 1:16 pm #4680443

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

What about the "/?lang=en" somehow? I cant find a way to include this.

Did you try setting up to something like hidden link

You can try adding those menu items to be Custom links.

I had an exact scenario few months ago, something like this:
https://wpml.org/forums/topic/menus-with-custom-links-anchor-based-does-not-show-language-switcher/page/2/#post-3324925

On a side note, when I'm visiting hidden link, it takes me to Norwegian homepage so I assume that it hasn't been translated or published yet.

Regards,
Bruno Kos

October 2, 2019 at 1:29 pm #4680527

christianA-18

Hi,

Yes, the english version is only visible when you're logged in, and the user is set up to show it.

The url you provided works perfect 🙂 I've earlier tried something similar – but had a / before the #. So it didn't work.

But what about the "hidden link" – as mentioned earlier? Do you have a fix for that for the english version?

Regards.

October 2, 2019 at 1:34 pm #4680629

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

hidden link;

If 723 is ID of the product as stored in the database, I assume that you should translate this URL to have the translated product URL instead. You can find out the ID by switching the language in the dashboard, hover over the title of the translated product and check the ID at the bottom of the screen.

I haven't found similar examples of this case though.

Regards,
Bruno Kos

October 2, 2019 at 1:45 pm #4681009

christianA-18

Hi,

Thanks again. I now found the id of the translated english product. But when using the new url "hidden link" it still redirects to the norwegian checkout. Is there a way to make it work so I'm sent to the english checkout?

Regards.

October 3, 2019 at 5:52 am #4684731

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I assume that all the pages (shop, checkout...) are translated? Can you also check this answer?
https://wpml.org/forums/topic/add-to-cart-button-redirecting-to-wrong-language-cart/#post-2248966

See this as well (if the above isn't working):
https://wpml.org/forums/topic/add-to-cart-button-is-not-working/#post-1525089

Also, does it happen with default theme (Twenty Nineteen)? Based on this, it can be related to the theme, this client provided a solution, it worked in their case though and not sure if it would work in others:
https://wpml.org/forums/topic/add-to-cart-unexpected-language-switch/#post-2532165

Regards,
Bruno Kos