I'm creating a custom template called archive-key_piece.php to accommodate the Custom Post Type, 'Key Pieces'. I would like to change the posts_per_page from 10 posts to 12. I have done so using query_posts('post_type=key_piece&posts_per_page=12&paged='.$paged);
The issue is that when I use query_posts(), it disables the pagination completely (even /key-piece/page/2/ won't work, it will just turn the same results as page 1).
When I use
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=key_piece&posts_per_page=12&paged='.$paged);
this allows me to access the next pages manually by url (key-piece/page/2/ etc.) but it still disables the next_posts_link()
I have also tried this in functions.php
function number_of_posts_on_archive($query){
if ($query->is_archive) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query->set('posts_per_page', 12);
$query->set('pagination', $paged);
}
return $query;
}
add_filter('pre_get_posts', 'number_of_posts_on_archive');
but with the same results.
Any help is greatly appreciated. Thank you!