Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
Sure, I can help you with that, but it requires changing one of the core files unfortuantely. I need to inform you that this change may have some negative effects, as the response body is not in json format, so the other plugin may encounter issues when trying to deserialize.
To change the header type:
– Open up thewp-content\plugins\ajax-search-pro\includes\classes\Hooks\Ajax\Search.phpfile on your server
– Go to line 121, which should be this:Ajax::prepareHeaders();
– Change it to:Ajax::prepareHeaders('application/json');
– Save the fileNow the responses from the live search are marked with the
application/jsonheader.Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi Boris,
Interesting question. I had to look into the source to see if there is any simple way of doing this, but I’m afraid this is not possible at the moment.
I think it might be doable though, I am not a 100% sure. I will take this into a feature request and see what I can do about it in a future release. (Possibly 4.27.1+, as 4.27 is very close to release).
Ernest Marcinko
KeymasterDo you mean in relation to the filters?
If the page is not marked with the parent categories, then it may not be possible, because in that case it is not in direct relation to them.Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
Well, I’m afraid this is not possible, maybe via a custom code. I have constructed a possible solution, but I could not test this, so be very careful. Make sure to create a range slider for the minTimezone custom field for this to work. The code will automatically identify and then separate it to two individual min/max query arguments with the correct fields right before the search.
Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_filter("asp_query_args", "asp_query_args_change", 10, 2); function asp_query_args_change($args, $search_id) { global $wpdb; foreach ( $args['post_meta_filter'] as $k => $filter) { if ( $filter['key'] == 'minTimezone' ) { $min = $filter['value'][0]; $max = $filter['value'][1]; unset($args['post_meta_filter'][$k]); // add the min $args['post_meta_filter'][] = array( 'key' => 'minTimezone', 'value' => $min, 'operator'=> '>=', 'allow_missing' => false ); // add the max $args['post_meta_filter'][] = array( 'key' => 'maxTimezone', 'value' => $max, 'operator'=> '<=', 'allow_missing' => false ); break; } } return $args; }Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYes please – that would be very nice. Let me know if you setup and I will test.
-
AuthorPosts