- This topic has 5 replies, 2 voices, and was last updated 2 years, 11 months ago by
David.
-
AuthorPosts
-
April 3, 2023 at 8:16 am #2594834
Andrew
We just enabled the new navigation search which is great (https://generatepress.com/a-new-navigation-search/). We are using WPML with language parameters however so our website adds lang=fr to the url when the user is in french. When a user is in french and they click on the magnifying glass it open up the dialogue in French (as expected) however the search results are sent to the english page as the lang=fr is removed from the URL. Is there anyway we can preserve that URL argument or some sort of hook we can connect to so we can add the url parameter with JS or PHP. I’ve reached out to WPML who asked me to connect with the GP forum. Thanks!
April 4, 2023 at 3:41 am #2596062David
StaffCustomer SupportHi there,
i must say, i have very little understanding of WPML or whether its getting in the way of these actions.
If i inspect the search form i see the opening tag:<form role="search" method="get" class="search-modal-form" action="https://yourdomain.ca/?lang=fr">And we can see the
action="https://yourdomain.ca/?lang=fr"includes the lang query string.
So in theory that should be consider in the resulting search terms ie.https://yourdomain.ca/?lang=fr&s=my_search_termBut it does not. Hmmm…
How does the core Search Block perform ? Does it keep the lang parameter in the search results?
To test this:
1. In Appearance > Elements -> Add New –> Block Element.
2. In the elements settings set the element type toSearch Modal
3. Add a core Search Block to the content.
4. Set the Display Rules to the Entire site.This will swap our search form for that block.
April 4, 2023 at 5:20 am #2596190Andrew
Hi David, thanks for the quick response. I don’t actually see a “settings” option when adding a block. Can you please confirm this is what I’m looking for https://ibb.co/f2xyB57. I’ll try out your solution to see if it works!
Thanks, Andrew
April 4, 2023 at 6:38 am #2596284David
StaffCustomer SupportAh, are you using Classic Editor plugin ?
April 4, 2023 at 6:58 am #2596328Andrew
Hi David, I was but I’ve disabled it and now everything shows up. I was also able to test and it turns out this solution does work! Thanks so much for sorting this out!
April 4, 2023 at 7:14 am #2596353David
StaffCustomer SupportAh, so it works with the core Search Block ?
If so ill do some tests as to why the themes search doesn’t -
AuthorPosts
- You must be logged in to reply to this topic.