WordPress.org

Ready to get started?Download WordPress

Forums

How to automatially add content to a post as time passes on (1 post)

  1. Anonymous
    Unregistered
    Posted 6 years ago #

    Hello,

    I have a series of posts that I want additional content viewable slowly over time. For example, I want a photo and description posted today, and on July 15th, an additional picture and description to appear in the same post. As a date passes, I'd like a snipped of additional content to appear.

    I've never written any PHP, and from looking around and trying to hack something together, here is my start

    This function is meant to take in the future date, and if today's date is greater than the future date, reveal the content....

    <?php
    function showcontent($Cutoffdate, $contentToShow) {
    $todays_date = date("m/d/Y");

    if (strtotime(date("m/d/Y", $Cutoffdate)) > strtotime($todays_date)) {

    print $contentToShow;

    }

    ?>

    And here is roughly what I'd like to include in the body of post. Basically, I want to set this up once and not have to come back and update it.
    <?php
    showcontent ("7/15/2008", "Here is some additional content for my current post");
    ?>

    <?php
    showcontent ("7/20/2008", "Here is some more content for my current post");
    ?>

    My question: in what PHP file do I stick my PHP function (which I hope is correct) and will the body of the WordPress post allow me to call my php function.

    Thanks for the help!

    Aaron

Topic Closed

This topic has been closed to new replies.

About this Topic