Forums

[resolved] How to post a sidebar message conditioned by date range (2 posts)

  1. Rena
    Member
    Posted 4 years ago #

    I am helping a friend merge several blogs done in Movable Type and PostNuke into a WordPress blog. Once all the old posts are imported, I want to have a message about these imported posts show on all archive pages within that date range (like 9/1/2003 to 5/24/2005), either in the sidebar, post meta data, wherever -- I'm not picky.

    I know I need to use the conditional tags for dates, but don't exactly know how to work out the multiple conditionals.

    Any assistance would be appreciated.

  2. Kafkaesqui
    Moderator
    Posted 4 years ago #

    Within the [post loop in single post pages you could accomplish this rather easily:

    <?php
    $testdate = get_the_time('Y-m-d');
    if( ($testdate > '2003-09-01') && ($testdate < '2005-05-24') ) :
    ?>
    Imported posts message goes here.
    <?php endif; ?>

    Now, if there are no posts previous to 9/1/2003:

    if( ($testdate < '2005-05-24') ) :

    will do.

Topic Closed

This topic has been closed to new replies.

About this Topic