Hi, I have a custom post type of 'Events' that have a custom fields for start date (startdate) and end date (enddate). I want to query them so that once an event happens it will it will disappear from the query. I'm not totally sure where to go with this, but any help would be appreciated. Thanks in advance.
It sounds like all you need to do then is grab out the end date into a variable and then wrap your output code in an if statement so that it only outputs the events if the end date is less than the current date.
This is the code that I have so far:
$CustomValueVariable = get_post_custom_values('CustomValueVariable ', $post->ID);
<?php echo $CustomValueVariable [0]; ?>
Here's the new code:
This website explains comparing dates:
http://www.highlystructured.com/comparing_dates_php.html
So you would have something loosely to the effect of:
WP_Query
Loop Posts
$EndDate = custom meta end date
if (currrent date is less than $EndDate):
---- Spit out the post data ----
end if
End Loop Posts