mercredi 4 février 2015

Pagination fault in custom post type archive page


I create ad custom post type register_post_type( 'videos', $args); and custom taxonomy for that register_taxonomy( 'video_category_categorie', 'videos', $args ); Maximum number of post displayed is 2 per page. Via word press backend in archive-videos. php i write the for displaying the post from a specific taxonomy ( taxonomy item id is 3 ) $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;



$args = array( 'post_type' => 'videos','paged' => $paged,'tax_query' => array(
array(
'taxonomy' => 'video_category_categorie',
'field' => 'term_id',
'terms' => 3)
));

$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo get_the_title().'<br>';
endwhile;
twentyfourteen_paging_nav();


Now i get the result correctly only pst from taxonomy id 3 is displayed. But the pagination is not correct. it showing 1 2 3 4 . actually there is 5 post that is in taxonomy id 3 . so the correct pagination is 1 2 3 .


And also when clicking 4 page the page didn’t show any post name .


Please help





Aucun commentaire:

Enregistrer un commentaire