if custom field is older than date next week
-
I’m trying to find a way to query on single.php if a post custom field (a date) is greater than a date 7 days in the future.
<?php $date1 = get_post_meta($post->ID, '_timestamp', true); $date2 = date('YmdHi', strtotime($date .' +7 day')); if ( $date1 > $date2 ) { ?>
The idea is to be able to filter those posts coming up in the new 7 days and those that are not. Custom field _timestamp outputs the date as YmdHi, so I’ve done the same with the date function.
Something doesn’t seem to be right though, and I’d appreciate any help with this.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘if custom field is older than date next week’ is closed to new replies.