lundi 5 octobre 2015

WordPress pagination not working with excluded posts

I'm using an array inside WP_Query, this is for the index.php page. The code is like so

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

    $args = new WP_Query( array(
       'post__not_in'       => $exclude_ids, // This works correctly
       'paged'              => $paged,
       'posts_per_page'     => 9, // I added this as a hope but didn't work
    ) );

$the_query = new WP_Query( $args ); ?>



<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

but the paged is not working. I echod took the $paged out and it is doing 1,2,3 like it should (I'm assuming?) so it that part is working, and the URL is changing and the pagination link recognises it's on page 1,2,3 but the posts are all the same.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire