Skip Navigation

[Resolved] Search Form and Search Result on different pages doesn't work with WPML

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 7.98 hours from now. Thank you for your understanding.

This topic contains 11 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 5 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2602595

Tell us what you are trying to do?

As you can see in the header of my website (hidden link), I have a toolset form. I'm using this shortcode: [wpv-form-view name="search-form" target_id="41611"] .
The results are displayed here on the french side (hidden link). It works well. However, I expected to have the results showing on the english version of the same page created using WPML when english is selected.
But it doesn't seem to work.

I probably need to translate the target id in the search form shortcode but I don't know where to find it. I tried to find it in the translation string but no luck. It might be more of a WPML issue but I'm not sure.
Any clue on what I'm doing wrong? Thanks!

#2602793

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

First thing first is important that you make sure all the search result items are translated into English.

So for example Ville de Nyon, Uniq, ...

The other point is that the search result page should be also translated into English.

To know what is the ID of the translated page go to WordPress Dashboard > Pages and from the top admin language bar change the language to English.

Search for the translation of the search result page. Hover over it with your mouse and on the left bottom of the screen of your browser you will see the link to the edit screen.

That link contains the ID of the translated post which you can use.

See if it helps.

#2603379

Hi Christopher,

Thank you for your answer.
Some posts are not translated and don't need to be in the search results, doesn't that can cause an issue?

The page ID for the search results in English is 41941. This page is connected to its equivalent in French.
So I'm not sure why it's not working.

Thank you for your help!

#2603761

Christopher Amirian
Supporter

Languages: English (English )

Screenshot 2023-05-07 at 18.53.57.png

Hi there,

The issue seems to be that the search result page is not translated as in the front end I only see the French flag and not the English flag (Check the screenshot).

Also, if you want some results to show in English even when they are not translated you need to follow the steps mentioned below:

https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/

Thanks.

#2604899

Hi Christopher,

The search result page is translated. (see attached) but the search results in english are still sent to the french page.

The form does include the ID of the french page as redirection page. So, the issue might come from there. I just don't know where to change the ID for the english version.

I don't need not translated content to be included. Just if I look for "work" on english site, I expect to find a list of english pages containing this word.

Thank you for your help!

#2605013

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. For the ID that you have mentioned you can search for it in the Admin Text section of WPML String Translation and include it in the string translation and then translate the ID to the English one.

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#strings-arent-selected-for-translation

But that should not be necessary I think. I'd appreciate it if you can provide the login information so I can check.

Please make sure that you have a backup or it is better to share the staging version of the website and also make sure that the next reply is set as private.

Thank you.

#2607821

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the details, I asked for a second opinion and I will get back to you as soon as I have an update.

Thank you.

#2609843

Hi,
I kept your access to the site so you can keep using the info I sent before. Here is a full backup of our website.
Let me know if that works.

hidden link

Thanks!

#2609983

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. I did not want to add additional plugin to your website to create a backup on a live website that is why I asked you to do that.

Thank you for the link. Just to make sure is it a Duplicator package or All In One Migration package?

Thanks.

#2610845

Christopher Amirian
Supporter

Languages: English (English )

#2611099
Screen Shot 2023-05-29 at 8.28.05 AM.png

Hi Christopher,

Thank you for your help. However, I don't seem to be able to make it work. I followed the instructions but no change.
Let me know what I'm doing wrong.

Thanks!

#2611237

Christopher Amirian
Supporter

Languages: English (English )

Screenshot 2023-05-30 at 12.20.32.png

Hi there,

For some reason, the custom code gets inactive for your website after saving.

I added the same code in WordPress Dashboard > Appearance > Themes > File Editor functions.php and it worked.

Thanks,.