WordPress.org

Ready to get started?Download WordPress

Forums

Modify Post Date to Tomorrow (8 posts)

  1. Chuck Reynolds
    Member
    Posted 4 years ago #

    Looking to have the ability to post today but have tomorrow's date... a schedule for tomorrow of sorts.

    Initially I was thinking the_date('j') + 1; but that's not working at all.

    Can't find any threads regarding this on the boards and no plugins that handle it. Thoughts?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You want to schedule a post for publication tomorrow? Or publish a post with tomorrow's date?

  3. Chuck Reynolds
    Member
    Posted 4 years ago #

    not schedule, that works out of the box... I want to post it today but have tomorrow's date...
    So basically a +1 modifier on the date but have the logic to roll over to the next month if, lets say, they post on the 31st and it would know to show the 1st.

    So basically the schedule for tomorrow goes up today so people can prepare by reading before the work day

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    What if you used PHP's date() function and fed it the post date plus 1 day?

  5. Chuck Reynolds
    Member
    Posted 4 years ago #

    think my syntax is just screwy now...

    got:

    <?php $mynewdate = strtotime($post->post_date) + (60 * 60 * 24); ?>
    <div class="day-<?php echo date('d',$mynewdate); ?>">

    (basically just need day to show up in class name for my css to pop my sprite)

    So what that code is doing is adding 1 to each day so no matter what day it is it always adds one... I just need it to add one to the original post date... and never change..

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    Just tried code in one of my themes and it's working fine as far as I can see. I'm echoing out a two-digit post date+1 day every time. Is that not what you want? Do you need this to be called only on specific posts?

  7. Chuck Reynolds
    Member
    Posted 4 years ago #

    well i'll build a category template for those posts but yeah only certain category posts are going to have the modifier...

    currently have this working (think, need more testing)

    <?php $mynewdate = strtotime($post->post_date). '+ 1 day'; ?>

  8. Chuck Reynolds
    Member
    Posted 4 years ago #

    after some more testing I realize this original code was working

    $mynewdate = strtotime($post->post_date) + (60 * 60 * 24);

    need to make sure it's still not adding a day each time... I just think that was a fluke as the client was manually editing post dates w/o me knowing lol

Topic Closed

This topic has been closed to new replies.

About this Topic