query_posts function question
-
I’m trying to do something simple, maybe there’s another way, but I’m looking to show posts on my main page for the last 2 (or 3) months. The below code works for one previous month:
————–
$current_month = date(‘m’);
$current_year = date(‘Y’);// Routine to deal with January
if ($current_month == 1)
{ $current_month = 13;
$current_year = date(‘Y’) – 1;
}// So go back one month
$current_month = $current_month – 1;query_posts(“year=$current_year&monthnum=$current_month&order=ASC”);
————
But trying to pull the last 2 months, even using this, doesn’t work:
query_posts(“year=$current_year&monthnum=7,8&order=ASC”);Any idea how i can embed 2 months or even a BETWEEN in the query_posts
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘query_posts function question’ is closed to new replies.