WordPress Version: 3.3.2
Assumption, My post in category 7 have 9 posts during October 2012.
by accessing
www.example.com/2012/10/?cat=7
I am able to view all in one page. No issue,
however, I create custom page category-7.php
in theme folder.
//listed category per page = 6
$query = 'posts_per_page=6&cat=7';
$year = get_query_var('year');
if($year > 0)
{
//build query string
$query .= '&year='.$year;
}
$month = get_query_var('monthnum');
if($month > 0)
{
$query .= '&monthnum='.$month;
}
$paged = get_query_var('paged');
if($paged > 0)
{
$query .= '&paged='.$paged;
}
query_posts($query);
Now I access again
www.example.com/2012/10/?cat=7
The bottom got Next Page option, but when I click it to
www.example.com/2012/10/page/2/?cat=7
I got "404 - Page not found!"
The only solution I can do is go to WP-Admin, Reading Settings change the "Blog pages show at most" variable to 6, then I got the correct output.
However, as I research in the wordpress page, by added query_posts
parameter, it should be work correctly.
Please advise. Thanks!