WordPress.org

Ready to get started?Download WordPress

Forums

Failure when 2 the_date tags (2 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    Hey, in the code for my front page I'm using 2 the_date tags, one to do some math and one to print out the day header and the results of that maths.. the code is below
    <?php
    //calculate when close
    $daythen = 1085698800 - 86400;
    $timealmostnow = the_date('d M Y','','',false);
    $daynow = strtotime("$timealmostnow");
    $almostday = ($daynow - $daythen);
    $day = $almostday / 86400;
    $day = floor($day);
    ?>
    <?php the_date("j M y","<h2> Day $day <span class=\"smaller\">",'</span></h2>');?>

    (the point of the code is to work out how many days have passed since one specific day)
    The problem is that I get the the day printing above every single entry, like it's the_time. Any suggestions?

  2. Nick Momrik
    Member
    Posted 10 years ago #

    Use the_time function instead.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.