WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I highlight posts older than 30 days? (3 posts)

  1. ibexy
    Member
    Posted 4 years ago #

    I would like to highlight posts older than a certain number of days, say 30 days with a small message below each post. The message could be "Post older than 30 days" etc Any help with this. Thanks :)

  2. MichaelH
    Member
    Posted 4 years ago #

    Test for posts that are so many days old date (in this case 46 days)

    <?php
    $mylimit=46 * 86400; //days * seconds per day
    //$post_age = date('U') - get_post_time('U');
    $post_age = date('U') - mysql2date('U', $post->post_date_gmt);
    if ($post_age < $mylimit) {
    echo 'this post is within my date limit ';
    }
    ?>
  3. ibexy
    Member
    Posted 4 years ago #

    Thanks but I found this plugin that seems to solve the problem.
    http://wordpress.org/extend/plugins/old-post-notifier/
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic