Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 thread is resolved. Here is a description of the problem and solution.

Problem:

Simple Job Board plugin - Pagination on the jobs page is not working when the Language URL format is Language name added as a parameter

Solution:

1. Add the following code to the functions.php file of your theme. You can add it at the end of the file.

if (get_option('icl_sitepress_settings')['language_negotiation_type'] == 3) {
	add_filter( 'sjb_pagination_links_default_args', 'wpml_fix_pagination', 10, 1 );
}

function wpml_fix_pagination ( $pagination_args ) {
	$default_lang = apply_filters( 'wpml_default_language', NULL );
	$current_lang = apply_filters( 'wpml_current_language', NULL );
	$base= substr($pagination_args['base'], 0, strpos($pagination_args['base'], '/?') + 1);
	$pagination_args['base'] = $base . '?lang=' . $current_lang . '&page=%#%';
	return $pagination_args;
}

Relevant Documentation:

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by Itamar 2 weeks, 1 day ago.

Assigned support staff: Itamar.

Author Posts
October 14, 2019 at 6:04 pm #4752261

lawrenceS-3

Tell us what you are trying to do?
I have English and Chinese. In Chinese, the URL is encoded an the page is redirected to some unwanted page
Is there any documentation that you are following?
My Previous support ticket about this
Is there a similar example that we can see?
Yes,
What is the link to your site?
hidden link

October 14, 2019 at 6:11 pm #4752269

lawrenceS-3

Issue:

1. When you visit the Chinese Home Page, hidden link and scroll half way down the page, you can see a pagination.

hidden link

Click on page 2 there. The URL will be encoded and you can not go to the original Page 2.

2. Similarly on the Job page, hidden link, when someone uses the search form and click n the search button, the page is redirecting to the English version.

I tried the Language switcher options, but can't make it work.

Any help appreciated.

October 15, 2019 at 2:34 pm #4758115

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

First, I need to let you know that this forum is public, so for the sake of your site's security, please refrain in the future to post sensitive data on a public reply.
If access is required to your site, then we enable a private message that only you and our support team can see. Otherwise, we are not allowed to access your site. For now, I've hidden the reply with the confidential information from above. Please change this sensitive login details also on your site.

It might be that the issue is happening because of the Language URL format that is selected on your site. The Language URL format is 'Language name added as a parameter'. In this case, you should try and add the pagination and search parameters so they will work with the Language parameter. You can see instructions about it on our documentation here.
https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/#preserving-url-parameters

But I also like to recommend that you use the 'Different languages in directories' Language URL format. This will likely solve this problem. You can read about it here.
https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/#languages-in-directories
But in this case, please be aware that the links to your site's pages will change. SO if you already shared a link to any of your site's pages with the 'Language name added as a parameter' option, it might not work anymore as expected.
In general, selecting the Different languages in directories option is better for SEO.

If you need more help from me, could you please share your Debug information with me?
You can read a detailed explanation about it here.
http://wpml.org/faq/provide-debug-information-faster-support
The debug info will give me a lot of information about how your site is configured and will help me understand the source of the problem.

Thanks,
Itamar.

October 21, 2019 at 1:08 pm #4794733

lawrenceS-3

Hello Itamar,

Thank you for your reply.

I don't want to use sub-directories in this case as it is not recommended by my developer.

And under WPML > Languages, the option "Language name added as a parameter" is already selected. But I can't find any way to add any parameters there. hidden link

Can you please help again?

Thank you.

October 22, 2019 at 6:30 pm #4805005

lawrenceS-3

Can I get a reply here?

October 23, 2019 at 9:40 am #4809619

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

In this case, please proceed with as instructed in our documentation here.
https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/#preserving-url-parameters
Please see the 'Settings for preserving URL arguments' section (the link will take you there.)
In the WordPress admin, you should go to WPML -> Languages -> Language Switcher Options -> Preserve URL arguments.
You should add the page parameters like so:

page=2, page=3, page=4, page=5, page=6

Please let me know if this information is helpful to you.

Regards,
Itamar.

October 23, 2019 at 11:59 am #4811103

lawrenceS-3

Hello Itamar,

I have already tried adding those pages as preserve URL. And done it again now.
hidden link

But still it is not working. Not sure what is the issue.

Any other suggestion?

October 24, 2019 at 1:38 pm #4820729

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks for trying my suggestions.

This might be an issue with the theme that you are using. The Architect by MyThemeShop. I don't have this theme with me (nor I can find it in our themes repository).
https://wpml.org/documentation/theme-compatibility/
To get advanced, we need to replicate the issue on a clean WordPress installation. For this, I created a test website with a clean WordPress install. You can access it through this link:
hidden link
Through this link, you will be automatically logged in. (If nobody logs in, the test site will be available for one week from today.)
Could you please install the Architect them and its add-ons and see if the issue is replicable on a clean WordPress installation?
Please configures WPML as it is configured on your site (at least default language and one other language). Please also make sure that you are installing the latest version of the theme.

Thanks,
Itamar.

October 24, 2019 at 3:02 pm #4821449

lawrenceS-3

Hello Itamar,

This is not an issue with the theme. I have enabled the default theme and I am getting the same behavior there too. So I think the plugin used there will be causing the issue.

And on your demo site I have installed the plugin, created 4 jobs (2 to show on English and 2 to show on Chinese page).

Please check the Chinese page. You can see that issue there too with the default theme.

I have not preserved any URL though for now.

Please check that.

October 25, 2019 at 5:59 am #4823953

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

OK, I'll check things on your site. Please share with me the access details to your site. I know that you have shared them with me at the beginning of this ticket, but I'm not allowed to use them is the sharing was not done correctly. When it is done properly, you are giving us your consent to enter your site's admin and approving us that you have made a backup in case something goes wrong.

If you need further help with this, please share the access details to your site with me.
I'm enabling a private message for the next reply.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- - Please make a backup of site files and database before providing us access. --

Thanks,
Itamar.

October 27, 2019 at 12:38 pm #4834449

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks for the access details.

The issue seems to happen because of the Simple Job Board by PressTigers. I was wrong to think that the cause is the theme. The Simple Job Board is not officially compatible with WPML.
And we might be looking here a compatibility issue. Our compatibility team can try to check if they can find a fix for this issue. For this, please proceed with installing the plugin and trying to replicate the issue on the fresh WordPress installation that I've previously install for you here. hidden link
Then when everything is ready, please let me know.

While I was on your site, I've checked whether the problem is also occurring if you switch the Language URL format to 'Different languages in directories in WPML -> Languages. And the problem does not happen in this case. Please see the attached screenshot. Please reconsider to switch to this option.

Before trying anything, please update WPML and its add-ons to their latest versions and see if it helps to solve the issue.

Thanks,
Itamar.

October 30, 2019 at 11:12 am #4854873

lawrenceS-3

Hello Itamar,

Sorry for the delayed response.

I have already set the plugin on the dummy you have shared in such a way that you can replicate the issue.

You just need to access this page:
hidden link

There you can see pagination where you can get the issue.

Also, on my site, I have updated all plugins now. Still the issue is there.

If I do not reserve he URL, I am facing other issues. So I have reserved them.

Looking forward to your reply.

Thank you.

October 31, 2019 at 3:44 pm #4865737

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks a lot for replicating the issue on the test site.

I've escalated this problem to our compatibility team, and they will check if they can find a fix for this issue. I'll keep you updated here for any news regarding this issue.

Thank you for your patience.
Itamar.

November 3, 2019 at 9:57 am #4876013

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

It is possible to correct the issue by the following.

1. Add the following code to the functions.php file of your theme. You can add it at the end of the file.

if (get_option('icl_sitepress_settings')['language_negotiation_type'] == 3) {
	add_filter( 'sjb_pagination_links_default_args', 'wpml_fix_pagination', 10, 1 );
}

function wpml_fix_pagination ( $pagination_args ) {
	$default_lang = apply_filters( 'wpml_default_language', NULL );
	$current_lang = apply_filters( 'wpml_current_language', NULL );
	$base= substr($pagination_args['base'], 0, strpos($pagination_args['base'], '/?') + 1);
	$pagination_args['base'] = $base . '?lang=' . $current_lang . '&page=%#%';
	return $pagination_args;
}

It is working on the test site. You can see it here.
hidden link
Can you pleasecheck if it also works on your site and if it does mark this ticket as resulved?

Thanks,
Itamar.

November 5, 2019 at 5:32 pm #4892199
lawrenceS-3

Hello Itamar,

Thank you for taking time to look at this. The code you have shared is working fine with the pagination.

Now there is another issue which I think is working previously. Please look at this page:
hidden link

Try adding any keyword in the search box, leave the dropdown as it is and hit search.

You'll notice the ?lang=zh-hans part will be removed from the URL and it'll load the Home page.

If by any means, the ?lang=zh-hans part will be there in the URL, that'll work fine for me and everything will be fixed.

Thank you.