2013-07-03

I've created a custom post type called "Events" and I am using Advanced Custom Fields (Wordpress plugin) to add custom fields to the posts. One custom field is the date of the event and my goal is to query the posts based on this date (which is stored in the database as "yymmdd") and only show future events. I've gotten close, but can't seem to figure out how to integrate the filter with the code I've already written.

I know that the Wordpress Codex has information on this here (http://codex.wordpress.org/Class_Reference/WP_Query) but being a novice with PHP, I'm at a loss as to how to make it work with my custom field data. Here's the Wordpress code:

But I'm not sure how to integrate this with my current query or how to use my date field as the query value rather than the post date. Below is what I've written so far.

I would really appreciate if someone could show me how to add the filter to my query and how to use the custom field meta for the date of the event rather than the post date. I think I've given all the information needed but let me know if I missed something. Thanks!

Show more