WordPress.org

Support

Support » Plugins and Hacks » Modify Post Date to Tomorrow

Modify Post Date to Tomorrow

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    @esmi

    Forum Moderator

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

    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

    esmi

    @esmi

    Forum Moderator

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

    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..

    esmi

    @esmi

    Forum Moderator

    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?

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

    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Modify Post Date to Tomorrow’ is closed to new replies.
Skip to toolbar