Forums › Forums › Search & Filter Pro › Additional Search field to hide post meta
- This topic has 10 replies, 2 voices, and was last updated 7 years, 2 months ago by Anonymous.
-
Anonymous(Private) October 6, 2017 at 3:41 am #135044
Hi, i have been working with you on this plugin and the integration with Event Espresso, i have a lot of events that are showing as sold out, what i would like to do is add an additional field so that, i have give the user the ability to hide all sold out events.
any pointers would be great. thanks
Anonymous(Private) October 9, 2017 at 6:07 am #135440Hi Trevor,
this is the reply i got back from Event Espresso
That’s actually in the wp_posts table which has the post_status field. When an event is sold out its post_status changes to sold_out.
I added a post meta option and looked though but dont seem to be able to conenct to it.
any suggestions?
thanks
Ryan
Trevor(Private) October 9, 2017 at 9:47 am #135453I do not think that this is going to be possible, at least not directly. The reason is two-fold. The first is that we index/filter meta data stored in the post_meta table, but this value is not stored in that table. As you say, this data is stored in the posts table, and it is stored as a WordPress array in that field.
It is accessed by the WordPress
get_post_status()
function:https://codex.wordpress.org/Function_Reference/get_post_status
To allow front end (user) access to this would be dangerous, as it would allow spoofing of the search query to show private posts. As such, it is not the most sensible of places to place such data. A custom meta field would have been a much better choice for the Event Espresso plugin authors. I would have thought that this would not be a difficult bit of coding for them to do, with a settings choice for the user to select which option they want to use.
Anonymous(Private) October 13, 2017 at 3:38 am #136406Hi trevor
This is the reply i got from event espresso
Hi Ryan,
I’m afraid their suggestion to store post statuses outside of the post_status field isn’t something that Event Espresso can do, and adding an option to toggle where post_statuses are stored isn’t a viable option.
If the developer of the search plugin wants to discuss this further with the Event Espresso developer team, they’re welcome to open an issue on github:
https://github.com/eventespresso/event-espresso-core/issuesthanks
Trevor(Private) October 13, 2017 at 9:17 am #136418The issue is that you want to give the user a switch. In V3 we may well be offering such an option, or at least one you could then use programmatically using our Edit Query Arguments.
That function can be used to add the post status to the query, but you need some means to decide if the user wants to do that.
Anonymous(Private) October 16, 2017 at 9:26 am #136709is there a way we can use a simple check box, what im thinking is to have the check box already selected in the search and filter bar, which will automatically hide the sold out events and if they wish to show then they could uncheck the box, not sure if something like this is possible.
what you think
regards
Ryan
-
AuthorPosts