Support » Fixing WordPress » Posts within the last 7 days

  • Resolved drmike

    (@drmike)


    Greets:

    I’m trying to figure out a mthod of displaying the posts created within the last x amount of days. I gather that this doesn’t work:

    $dt_start = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
    $dt_recent = $dt_start - 604800;
    
    $query2  = "SELECT * FROM wp_posts WHERE $dt_recent <= strtotime('post_date_gmt') ORDER BY ID";

    Suggestions?

    Thanks,
    -drmike

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Posts within the last 7 days’ is closed to new replies.