Liam Richardson
Liam Richardson

Reputation: 151

Pagination not working

I'm trying to place pagination links onto my custom Wordpress homepage loop but for some reason it just isn't working. Nothing is showing up at all, not even an empty DIV.

I'm using the kriesi_pagination solution, the code for which can be found via the link.

Here is my loop code, if it's of any help:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$query = new WP_Query( array( 'post_type' => array( 'post',  'reviews', 'features', 'podcasts' ), 'posts_per_page' => 2 , 'paged' => $paged ) );

if(have_posts()) : while($query->have_posts()) : $query->the_post(); ?>

The function is being called after the endwhile; statement at the bottom of the loop.

Any ideas why this isn't working? It's driving me insane!

Upvotes: 1

Views: 174

Answers (1)

gwdo
gwdo

Reputation: 163

You can try to change your $query variable name into $wp_query like this:

$wp_query = new WP_Query( array( 'post_type' => array( 'post',  'reviews', 'features', 'podcasts' ), 'posts_per_page' => 2 , 'paged' => $paged ) );

if(have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>

...It may help (as some pagination functions expects query object to be called this way), however you should check if other queries on your site were not affected by this change.

Upvotes: 1

Related Questions