• 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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sikhyouth

    (@sikhyouth)

    Basically, if this is the SQL i need the WordPress PHP version:

    post_date > ‘”.current_time(‘mysql’)

    Thread Starter sikhyouth

    (@sikhyouth)

    anybody??? please !!

    Thread Starter sikhyouth

    (@sikhyouth)

    somebody must have an answer..

    Thread Starter sikhyouth

    (@sikhyouth)

    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; ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Please Help – current_time great or equal to post_date’ is closed to new replies.