WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Posts for Certain Date as Front page? (2 posts)

  1. damonw545
    Member
    Posted 7 years ago #

    Hi all,

    I'm using WordPress to manage a small weekly newspaper's web site. Previously we had a static front page and then you would click on the "latest issue" link (created by wp_get_archives('type=daily&limit=1');) to view the latest issue's articles.

    Now I want the front page to show ONLY the posts from the date of the latest post... In other words, only the past week's issue.

    Is there a way to do this? I'm stumped!

    Thank you,
    Damon

  2. damonw545
    Member
    Posted 7 years ago #

    I DID IT!

    Here's how:

    In home.php just before the loop:

    <?php 
    
    $fulldate=explode('-', get_lastpostdate());
    $year=$fulldate[0];
    $month=$fulldate[1];
    $day=explode(' ', $fulldate[2]);
    $day = $day[0];
    
    ?>
    
    <?php query_posts("&year=$year&monthnum=$month&day=$day"); ?>

    [[THE LOOP]]

Topic Closed

This topic has been closed to new replies.

About this Topic