Forums › Forums › Search & Filter Pro › Show Events based on Post Meta
- This topic has 5 replies, 2 voices, and was last updated 9 years, 8 months ago by Ross.
-
Anonymous(Private) January 25, 2015 at 2:41 am #10907
I would like to show events (custom post type) based on a custom field called wpcf-event-date, so that only future events are displayed. I have tried using the ‘Post Meta’ tab under ‘Settings and Defaults,’ however that doesn’t seem to be working. Based on others’ support requests, I suspect the issue is that the wpcf-event-date meta values are being stored in UNIX time, not YYYYMMDD format.
Do you have any suggestions as to how I can solve this issue without modifying the post meta values stored in the database?
Thank you!
Ross Moderator(Private) January 26, 2015 at 2:41 pm #10935Hey Daniel
Unfortunately the post meta date only works as YYYYMMDD however lucky for you I believe the unix timestamp is the best way to store this info – I’ll look at adding it to the plugin over the next week or so.
*edit – however, when you use a post meta field in your search form, you are able to choose if the saved format is timestamp or YYYYMMDD
Thanks
Ross Moderator(Private) February 25, 2015 at 12:09 am #12347Hey Daniel
Just looking to implement this but I’ve hit a logic snag…
If I was going to compare to the current date, as a timestamp, what time in the day should that timestamp be? Or should it not be the current date, but the current time, as in the timestamp of right now?
I think this would be the best option, so I could add another option the in the dropdown called timestamp, under say date, where the user could enter the timestamp manually or tick “current date and time”.
What do you think?
Anonymous(Private) February 25, 2015 at 9:34 am #12364Good question, and yes, I agree that it should be based on the current time, as you suggest, as that method is more precise than picking a particular time of day.
Thank you again for the plugin. The design is really intuitive, and it works superbly.
Daniel
Ross Moderator(Private) March 5, 2015 at 11:04 pm #12880Hey Daniel
About to update the plugin and this has been added in.
Just something to note – the comparisons are done against unix timestamps – not JS timestamps which includes the milliseconds (3 digits longer).
Thanks
-
AuthorPosts