Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Custom URL on filter results
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 4 years, 6 months ago.
- AuthorPosts
- October 15, 2019 at 8:53 am #24326
I am using Ajax Search Pro to filter my Avada portfolio results – the plugin is great but I have a requirement which Ernest Marcinko said you should be able to do.
I have been speaking to Ernest about enabling the user being able to click through to a custom URL (that has been defined in the portfolio page). This custom URL works if I use Avadas filters (which aren’t great) but ASP blocks the assigned custom URL and defaults back to taking the user to portfolio page URL (which my client doesn’t want).
Avada have supplied me with the wrapper code for the custom url (attached).
This is the portfolio results page:
http://develop1.therainbowmash.co.uk/escape-rooms/Attachments:
You must be logged in to view attached files.October 15, 2019 at 1:35 pm #24336Hi,
Thank you for all the details, I have managed to find the link sources. It was not exactly what the Avada team sent, but the link was stored in the “pyre_link_icon_url” custom field.
I have constructed a small custom code snippet to replace the link URLs, where this custom field is defined. I have placed the following custom code to the functions.php file in your theme directory, please keep a copy of it just in case. It should be all right now.
Best,// AJAX SEARCH PRO SPECIFIC add_filter( 'asp_results', 'asp_custom_link_meta_results', 10, 1 ); function asp_custom_link_meta_results( $results ) { // Change this variable to whatever meta key you are using $key = 'pyre_link_icon_url'; // Parse through each result item foreach ($results as $k=>$v) { if ( function_exists('get_field') ) $new_url = get_field( $key, $v->id, true ); // ACF support else $new_url = get_post_meta( $v->id, $key, true ); // Change only, if the meta is specified if ( !empty($new_url) ) { $results[$k]->link = $new_url; } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 15, 2019 at 4:44 pm #24339HI Ernest
Thank you very much this si great! I really appreciate it!
I have duplicated the functions.php file and stored safely.
Do I need to replace the functions.php file with your amended version after every Avada update or is it better to paste the code into the updated functions.php file?
Ideally I would have created a child theme initially but I don’t want to lose all the work I have done up to this point.
Thanks
October 16, 2019 at 8:21 am #24344It will be probably lost during the theme update. A child theme would be the only solution to keep the changes. Until then, you can re-enter the code to the functions.php file after each theme update if needed.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 16, 2019 at 8:50 am #24349Thanks very much for your help!
October 16, 2019 at 9:30 am #24350You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 16, 2019 at 2:43 pm #24352I have reviewed and give 5 stars!
One thing actually – is there an ability to have just the filter drop down menus without the search bar? And have the drop downs on screen at all times?
Thanks
Chris
October 16, 2019 at 4:03 pm #24353Thank you very much 🙂
Yes, this is the option you are looking for: https://i.imgur.com/hpjgupL.png
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Custom URL on filter results’ is closed to new replies.