WordPress.org

Ready to get started?Download WordPress

Forums

If no post today, display next future post (6 posts)

  1. gaberosser
    Member
    Posted 2 years ago #

    I am using the following code to display one, published post on my site.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I need to adjust this to display the next, unpublished post (ie. 'post_status'=> 'future') in the event that there isn't a post that day.

    Example: Admin plugs in 3 posts, one scheduled for Friday, one for Monday, & one for Tuesday (No posts Sat or Sun). On Friday, this section should display the title of Friday's post. On Saturday, however, it should display the title of Monday's post. I REALLY feel like this can be done with if statements of some sort. Can it?

  2. gaberosser
    Member
    Posted 2 years ago #

    Anyone, anyone? :)

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    maybe start be reposting your code acccording to the forum rules?

  4. gaberosser
    Member
    Posted 2 years ago #

    Okay, thought I used "code" button before... http://pastebin.com/QNzttjyz

  5. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    a possible way to do it:

    (get todays post, or the next one in the future)

    http://pastebin.com/DuF28FSR

  6. gaberosser
    Member
    Posted 2 years ago #

    I believe this worked perfectly! Thanks so much @alchymyth!

Topic Closed

This topic has been closed to new replies.

About this Topic