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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Raja Mohammed 8 months, 1 week ago.

Assigned support staff: Raja Mohammed.

Author Posts
February 5, 2019 at 10:22 am #3161244

world-sustainability-organizat

I have a custom theme and I'm using Elementor for page content.

The theme template includes some fixed links and I have tried both the wpml_permalink filter and the WP get_permalink() function, both return the same result and it's not correct:

The page slug is translated, so I expect that:
hidden link (default is italian) gets converted to
hidden link

instead I get
hidden link which clearly does not exist (I have forced full resolution in the filter, but with no result).

Links in menus are mapped correctly, though.

Best regards

February 6, 2019 at 9:18 am #3164709

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi there,

Welcome to our forum,

I think you are trying to translate the hardcoded links in your theme template, correct me if I'm wrong. We have detailed documentation on how to translate the hardcoded slugs please refer https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/hard-coded-theme-links/

So if you want to translate the link '<a href="/nome-pagina">No Pagin</a>' You need to get the page id of the link and use the filter

 
// assuming page id of nome-pagina is 3
apply_filters( 'wpml_element_link', 3, 'page');

The above filter will return translated link as <a href="en/page-name">En no pagin</a>

If this is not your case, Can you please clarify with some more information.
- Where the link is present in the theme file
- Please provide us with the code snippet.
- Is it added to the Menu if yes, in that case, did you try to translate it using WPML > String translation please refer for a detailed explanation https://wpml.org/documentation/getting-started-guide/translating-menus/#translate-custom-links

Let me know the results, If you need further assistance don't hesitate to write back i will be happy to help you.

Kind regards,
Raja