[Resolved] Querying posts over the past X days
I’m currently using a query method that I found in these forums a while back, which allows you to query posts for the current month and year, like so:
<?php $current_month = date('m'); ?> <?php $current_year = date('Y'); ?> <?php query_posts("showposts=5&year=$current_year&monthnum=$current_month") ?> <?php while (have_posts()) : the_post(); ?> ...
It does the job as the month progresses, but the beginning of each month means the lists start with a blank slate, which can look extremely awkward.
My question is, are they any ways to run a query for the past say 7 or 14 days? Each day the list would bump up and include the current one, and scrap the last day in the list (8th or 15th day).
Thanks in advance guys.
- The topic ‘[Resolved] Querying posts over the past X days’ is closed to new replies.