Forums

[Plugin: Search Everything] How do I hide future posts? (4 posts)

  1. waffles
    Member
    Posted 1 year ago #

    This plugin is exactly what I want, except that it also shows posts that are scheduled to be published in the future.

    I have a photo blog and get a large group of posts ready in one day. If my visitors can search for the photographs that will show up later, it almost ruins the whole point of scheduling them to appear once a day.

    Is there anyway to have this plugin check the date and time now and only show posts that are published before that time?

  2. dancameron
    Member
    Posted 1 year ago #

    you should be able to use the postid.

  3. haagendazs1
    Member
    Posted 1 year ago #

    hi i have the exact same problem!

    i even tried to do a thing with compare the_date() with date() and if show the post only if the_date() < date(), but for some reason it didn't really work.

    itd be great if someone could figure this one out :)

  4. haagendazs1
    Member
    Posted 1 year ago #

    oh i think i got this one. instaed of using the_date i used get_the_time()

    so just make a variable

    <?php $thispostdate = get_the_time('YmdHis');
    $currentdate = date('YmdHis'); ?>

    then make an if statement saying if thispostdate is before currentdate, then show

    <?php if ($thispostdate < $currentdate) : ?>
    bla bla bla
    <?php endif; ?>

    this works because the date format YmdHis will always have 14 characters in it

Topic Closed

This topic has been closed to new replies.

About this Topic