sikhyouth
Member
Posted 3 years ago #
Hello everyone,
Could you please help me?
I just need an "if" statement in php for wordpress, where I can make certain posts display only if the date of the post is greater than the current date.
This is for future posts, listed on the homepage with their future dates. I do not want to show any post that is not in the present or future (i.e. any posts that have a timestamp of before today's date).
Thank you very much!
sikhyouth
Member
Posted 3 years ago #
Basically, if this is the SQL i need the Wordpress PHP version:
post_date > '".current_time('mysql')
sikhyouth
Member
Posted 3 years ago #
sikhyouth
Member
Posted 3 years ago #
somebody must have an answer..
sikhyouth
Member
Posted 3 years ago #
ok despite getting no help i found the solution
<?php
$posttime = strtotime($post->post_date);
$currtime = time();
$today = date('M d',$currtime);
$postday = date('M d',$posttime);
if($postday>$today) : ?>
all posts will have to have a timestamp of later than today's date
<?php endif; ?>