Template Pagination WP_Query not working
-
Hello,
I have created a template for a page to display only posts from a specific category. Everything works except for the pagination. I have tried all the suggestions posted here and it still doesn’t work.
Please help!
Here is my code:
<?php
$cat = array(228);
$do_not_show_stickies = 1; // 0 to show stickies
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;$args=array(
‘category__in’ => $cat,
‘caller_get_posts’ => $do_not_show_stickies,
‘paged’ => $paged,
‘posts_per_page’ => 10,
);$temp = $my_query;
$my_query= null;
$my_query = new WP_Query($args);
?><?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>….
<?php endwhile; ?>
<?php $my_query = null; $my_query = $temp;?><!– Previous/Next page navigation –>
<?php next_posts_link(‘« Older Entries’) ?>
<?php previous_posts_link(‘Newer Entries »’) ?><?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
The topic ‘Template Pagination WP_Query not working’ is closed to new replies.