Filtering posts by custom fields values
-
Hi there,
I have a bit delicate problem I can’t solve myself for hours…Here is what I’m trying to do:
I want to display an upcoming events in local restaurant, whole output is heavily customized (by CSS) so I can’t use any Events plugin.The idea is simple, display posts referring to today’s or future event and hide (move to the Archive category) older events (yesterday and older). But here is the problem… posts are published long before event actually happens so that means I can’t filter posts by using query_posts with time parameters.
Only idea which came up to my mind is filtering by custom field value. While entering a posts (event) you specify current date (let’s say 18.12.2009 – tomorrow). And some kind of script will check the current date and date in custom field. If the date in custom field is older that post won’t shows up and vice versa. The archive page do it reversed, display posts older that today’s date.
But the problem is I have no idea how to compare custom fields with today’s date in WordPress template file. Please, does anyone have an idea how to do this? I’m also opened to any other suggestions that will lead to success :).
Thanks a lot…
- The topic ‘Filtering posts by custom fields values’ is closed to new replies.