Forums

Show posts since last Monday (1 post)

  1. beefyo
    Member
    Posted 5 years ago #

    Well, any day really but this is what I want to do - show all posts from a previous day up until a current date.

    I tried the following code, but it seems to repeat itself. Admittedly I'm pretty new when it comes to this stuff:

    <?php
    $day = date("d");
    $month = date("m");
    $year = date("Y");
    $whichtime = mktime(1, 1, 1, $month, $day, $year);
    $lastmonday = mktime(1, 1, 1, date("m", strtotime("last Sunday")), date("d", strtotime("last Sunday")), date("Y", strtotime("last Sunday")));

    while ( $whichtime != $lastmonday) {
    ?>

    <?php query_posts('day=$day&month=$month&year=$year'); ?>

    <?php while (have_posts()) : the_post(); ?>

    **Post layout**

    <?php endwhile; ?>
    <?php
    $day = date("d", strtotime("-1 day ", $whichtime));
    $month = date("m", strtotime("-1 day ", $whichtime));
    $year = date("Y", strtotime("-1 day ", $whichtime));
    $whichtime = mktime(1, 1, 1, $month, $day, $year);
    } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic