Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Horizontal search URL don't take correct language
- This topic has 21 replies, 2 voices, and was last updated 5 years, 11 months ago by
smartbrand.
-
AuthorPosts
-
June 22, 2020 at 3:05 pm #28023
smartbrand
ParticipantHi,
We have detected a problem.
When we show search results in horizontal view, it doesn’t catch WPML language correctly. It takes the main language, and get his URLs incorrectly. It takes the URL of the main language, and not the current language one (https://prnt.sc/t4d1o7).
We use the WPML plugin to work the languages, where the main language is Spanish and we have English and French as children.
It’s possible ti disable this results at this moment?
Can you help us to resolve this issue?
Thanks in advance,
June 22, 2020 at 3:35 pm #28026Ernest Marcinko
KeymasterHi,
Looks like the wpml_permalink call is not resolving the URLs correctly. I looked up their documentation, and there seems to be a way to force that. This requires a bit of custom code, but should hopefully work.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter('asp_results', 'asp_full_resolve_wpml', 10, 4); function asp_full_resolve_wpml( $results, $id, $is_ajax, $args ) { foreach ( $results as $k => &$r ) { if ( isset($r->post_type) ) $r->link = apply_filters( 'wpml_permalink', get_permalink($r->id), $args['_wpml_lang'], true ); } return results; }Let me know if it works.
June 22, 2020 at 4:00 pm #28027smartbrand
ParticipantHi Ernest,
We tried adding this code in our theme function.php file, but not resolve the issue.
Nothing change 🙂
We add tis code in ‘/var/www/bh.fitness/htdocs/content/plugins/ajax-search-pro/includes/views/results/horizontal.php’:
<?php if (!empty($r->post_type)) $r->link = get_post_permalink($r->id); ?>And resolve it. It’s correct?
Thanks,
June 23, 2020 at 7:11 am #28034Ernest Marcinko
KeymasterThat is very interesting. If that works, you can of course use that as a solution. I will try to integrate one for the upcoming release if possible.
June 23, 2020 at 7:27 am #28035smartbrand
ParticipantHi Ernest,
Ok, thanks.
Yes you integrate if you can because is very easy and resolve this problem.
Thanks
June 23, 2020 at 11:41 am #28045smartbrand
ParticipantHi Ernest,
We try today and happens again. The issue issn’t resolved.
At the moment can we disable this 2 suggestions (https://prnt.sc/t4wlkq). The issue is only in this results and while you try to correct the error, we need to disable it.
What more can we try?
Thanks in advance,
June 23, 2020 at 11:47 am #28046Ernest Marcinko
KeymasterYou cannot access this content.
June 23, 2020 at 3:04 pm #28054smartbrand
ParticipantHi Ernest,
I’m creating FTP acesses, but you say us how can we disable this 2 suggestions (https://prnt.sc/t4wlkq). The issue is only in this results and while you try to correct the error, we need to disable it.
Thanks,
June 23, 2020 at 3:24 pm #28055smartbrand
ParticipantYou cannot access this content.
June 24, 2020 at 1:44 pm #28074Ernest Marcinko
KeymasterHi,
You can exclude those results until then. I tried to connect with the details, but the server says that password authentication is denied. Can you please check?
June 24, 2020 at 2:43 pm #28075smartbrand
ParticipantYou cannot access this content.
June 25, 2020 at 11:56 am #28081smartbrand
ParticipantHi Ernest,
We force to disable horizontal results.
Please, can you help us tu resolve the issue?
Thanks,
June 25, 2020 at 12:43 pm #28084Ernest Marcinko
KeymasterHi,
Thank you, the FTP works now. However when I tried to access the back-end I’m getting the following error: https://i.imgur.com/OwxSF6g.png
It looks like you have some sort of a DB cache active with W3TC. I very strongly recommend turning that off, that could very well cause this issue as well. I checked WPML API, everything related on how to correctly use it, but the code the plugin uses is perfectly correct. I’m afraid there might be something else causing the conflict as well.
June 25, 2020 at 12:51 pm #28085smartbrand
ParticipantHi Ernest,
Can you do it directly please, and i test i. I can’t disabled
Thanks,
June 25, 2020 at 12:54 pm #28086smartbrand
ParticipantHi Ernest,
We desactivate W3TC plugin to try it, but not resolve this issue.
We don’t have any Cache.
Can you help us?
Thanks,
-
AuthorPosts
- You must be logged in to reply to this topic.