- This topic has 3 replies, 2 voices, and was last updated 4 years, 10 months ago by
Support Team.
- AuthorPosts
- July 5, 2018 at 11:05 pm #7358
MrOlans
ParticipantHello all
Ive been trying to make a query form using wp_travel_posts_filter but add extra functionality to filter posts on trip fact value. I created a form to get the desired value but when it comes to query Im stump 🙁
My attempt to do search.
Please advise on what to use for $my_value ?Example
$query->set('meta_key', 'wp_travel_trip_facts'); $query->set('meta_query', array( array( 'key' => 'wp_travel_trip_facts', 'value' => $my_value, 'compare' => 'LIKE', ), ));
If there a better way to query against trip fact and I am incorrect?
Apologies for my english
July 6, 2018 at 6:06 am #7362Support Team
KeymasterHello @meolans,
First of all thank you very much for using the WP Travel plugin 🙂 .
The feature you have mentioned is currently not available in the plugin but the feature is noted as the requested feature and will be available in the next update of the plugin. Further please let us know what type of field do you want to add in the filter widget?
Now regarding your query about the code, we have made some changes in your code attempt and has provided the code you need to add to make the filter work with the facts.
if ( isset( $_GET['fact'] ) ) { $fact = $_GET['fact']; $query->set('meta_key', 'wp_travel_trip_facts'); $query->set('meta_query', array( array( 'key' => 'wp_travel_trip_facts', 'value' => $fact, 'compare' => 'LIKE', ), )); }
Here you need to pass the value to the fact and to be clear on this please refer to below-given screenshot:
Hope this helps.
Let us know if this works for you or not. If not then please provide the detail about the process you have done so that we can help you further,
Thank you.
Best Regards!!
Have a good day 🙂 .
July 6, 2018 at 6:17 pm #7382MrOlans
ParticipantGreat I am looking forward to that feature 🙂
Your response was what I was looking for I only showed a part of code to make it easy for you to see
So close I was in the solution… I had incorrect value for $factThank you for being very helpful you will be rated highly 🙂
July 9, 2018 at 5:29 am #7383Support Team
KeymasterHello @mrolans,
Thank you very much for the effort 🙂 .
If you face any difficulty/problem further then please let us know.
Thank you.
Best Regards!
- AuthorPosts
- The forum ‘WP Travel’ is closed to new topics and replies.