Skip Navigation

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

Problem:
The client was experiencing an issue where the URLs in the Nectar Slider were not being translated correctly and were always pointing back to the English version.

Solution:
We provided a workaround to address the issue with the Nectar Slider post type. Before proceeding, we emphasized the importance of backing up the database and website.

1. Edit the file

/wp-content/plugins/salient-nectar-slider/includes/frontend/helpers.php

2. Around line 814, replace the existing code for button 1 URL with the following custom code:

if ( ! empty( $button_1_text ) ) {

	// WPML Workaround for compsupp-7240
	if (class_exists('Sitepress') && ! empty( $button_1_link ) ) {
		$current_lang = apply_filters( 'wpml_current_language', NULL );
		$button_1_link = apply_filters( 'wpml_permalink', $button_1_link, $current_lang, true );
	}
	
	$button_1_link = ! empty( $button_1_link ) ? $button_1_link : '#';
}

3. Apply the same workaround for button 2 URL around line 845 with similar custom code.
4. After creating and translating a Nectar Slider post, edit a page, add the Nectar Slider element, select the slider location, save, and translate the page. The internal URL will then be adjusted in the frontend.

Please note that this solution might be outdated or not applicable to your case. If it doesn't resolve your issue, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

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

Last updated by Long Nguyen 8 months, 1 week ago.

Assisted by: Long Nguyen.

Author Posts
March 5, 2024 at 2:49 am #15372477

bradC-7

Thank you for doing some of the initial legwork to get a sandbox started.

I also tried reproducing the nectar slider with a button pointing to the same post as a test and see the following (see attached) where the URL was automatically copied and is not being flagged as I think it should (dynamically in the background, hidden from view unless searched in the translation editor).

I think the common thread here is the way these URL's are input so I am also confirming with themenectar support that these are setup to be handled correctly. Can you please confirm that you are seeing the same behavious as I am, where the XML is in place as it should be, yet the URL still points back to English version only?

Thanks in advance,
Brad

March 5, 2024 at 3:02 am #15372480

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Brad,

Here is the new ticket. I'm discussing this issue with our 2nd tier support. I will update you here when I have something to share.

Thanks for your patience.

March 5, 2024 at 4:05 pm #15375431

bradC-7

Thank you Long, appreciate it!

The fact that the XML code is needed makes me wonder if there is something specific that the theme author is not doing properly with how their links are handled.

I'll keep an eye for any responses here. Thanks again

March 6, 2024 at 1:51 am #15376798

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got a workaround from our 2nd tier support to fix the issue with the Nectar Slider post type, please check it below:

❌ IMPORTANT: Please backup your database and website before proceeding ❌

- Edit the file /wp-content/plugins/salient-nectar-slider/includes/frontend/helpers.php
- Around line 814, replace the code

if ( ! empty( $button_1_text ) ) {
	
	$button_1_link = ! empty( $button_1_link ) ? $button_1_link : '#';

with this one

if ( ! empty( $button_1_text ) ) {

	// WPML Workaround for compsupp-7240
	if (class_exists('Sitepress') && ! empty( $button_1_link ) ) {
		$current_lang = apply_filters( 'wpml_current_language', NULL );
		$button_1_link = apply_filters( 'wpml_permalink', $button_1_link, $current_lang, true );
	}
	
	$button_1_link = ! empty( $button_1_link ) ? $button_1_link : '#';

after you create a Nectar Slider post and translate it, you can edit a page > Add the element Nectar Slider > Select the slider location > Save and translate the page. Then the internal URL will be adjusted in the frontend.

You can apply the same workaround with the button 2 URL around line 845

if ( ! empty( $button_2_text ) ) {

	// WPML Workaround for compsupp-7240
	if (class_exists('Sitepress') && ! empty( $button_2_link ) ) {
		$current_lang = apply_filters( 'wpml_current_language', NULL );
		$button_2_link = apply_filters( 'wpml_permalink', $button_2_link, $current_lang, true );
	}
										
	$button_2_link = ! empty( $button_2_link ) ? $button_2_link : '#';

Please check the slider URL on the sandbox site hidden link

Looking forward to your reply.
Thanks

March 9, 2024 at 4:53 am #15391092

bradC-7

Thank you Long, I will make that implementation when I am back in the office.

Is this something I can also share with the theme author as I interpret this as suggesting that they have some further work to be properly compatible.

I have a ticket open with them and can share this with them after I am able to implement and report back on its success.

Thanks again, appreciate your continued effort on this! We will get there!!!
Brad

March 11, 2024 at 1:55 am #15393050

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

First thing, please make a full backup of your site and apply the workaround to see if it works, then let us know. Our compatibility team is in contact with the theme author so we will inform them about the issue and workaround.
You can also help us increase the priority of the issue by sharing this ticket with the theme author.

Thanks for your co-operation.

March 15, 2024 at 12:13 pm #15414209

bradC-7

Thank you Long, I have a ticket with them (hidden link) and will share this as well. I'm hoping this gets to the root cause of my issue and really appreciate the time and attention to get back up and running!

(I still haven't been able to implement change in our theme files... I'll be in next week)

Thanks again!
Brad

March 18, 2024 at 1:45 am #15419039

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

I'm waiting for your feedback.

Thanks.

March 18, 2024 at 2:13 pm #15421582

bradC-7

Hello Long, I wanted to follow up to let you know that I finally got to implementing this change in the theme slider plugin file and the URL's are now working in the slider!

I think this helps narrow down the other issues to suggesting it is on the part of the theme rather than solely on WPML.

Thank you for the support. I still have a couple of other ongoing tickets and the nectar elements used elsewhere need to be addressed but wanted to first of all, confirm that this worked (I expect to see the theme author push this out officially in an update...) and thank you again for getting this looked at.

Kind regards,
Brad