if < todays_date = date from custom field > do stuff
-
Can somebody please help me with this code?
//<?php query_posts(‘category_name=events’);?>
<?php $todays_date = date(“Y-m-d”); if (have_posts()) : while (have_posts()) : the_post(); ?><?php $event = get_post_meta($post->ID, ‘event’, $single = true); ?>
<?php $start_date = strtotime($event); ?>
<?php $today = strtotime($todays_date); ?><?php if(“$start_date = $today”) { ?>
<?php the_title(); ?>
<? } ?>
<?php endwhile; else: ?>
<p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
<?php endif; ?>//I have a custom field labeled “event” which has date values of this type 2008-08-09. On home page of my blog i only want to show posts that have the “event” custom field date value equal with the current server date value. With the above code every post from the event’s category shows up. Any help is very much appreciated.
here is my test page: https://viku.aseptic.ro
- The topic ‘if < todays_date = date from custom field > do stuff’ is closed to new replies.