I am creating a template to get alle posts from category 9 into one page. But I want this also to be paginated, as there will be more than 30-50 posts.
I have tried several things:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$my_query = new WP_Query('cat=9&showposts=5&paged=$paged'; ?>
and
<?php query_posts('cat=9&showposts=5&paged=$paged'); ?>
even
<?php
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
query_posts( array( 'post_type' => 'post', 'paged' => $paged, 'cat'=> 9, 'posts_per_page' => 5 ) );
?>
The pagination stays the same: only 1 page and it shows the 5 posts, but there are several more posts, so it should show the pagination right?
Any help is gladly appreciated!