The description
Hi, I am using a custom post type and a loop through the values I show.
I'm using a term ($ term) that comes from a previous page in the loop to only show related items.
Just for a test run I configured in the administration of wordpress in the reading section, show only two post.
I'm also using a custom post type associated taxonomy as follows:
<?php
// Argumentos del loop
$argumentos = array (
'post_type' => 'placas',
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => 'firmas',
'field' => 'slug',
'terms' => $term
)
)
);
$query_productos= new WP_Query($argumentos);
?>
The pagination made this way works well
<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
The Problem
But I need to display 4 post, so try this.
This shows me 4 post related to the term
<?php
// Argumentos del loop
$argumentos = array (
'post_type' => 'placas',
'posts_per_page' => 4,
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => 'firmas',
'field' => 'slug',
'terms' => $term
)
)
);
$query_productos= new WP_Query($argumentos);
?>
The problem is that the links next returns me an extra one, without content. Only have 6 post published and I should only have 2 pages for paging, but actually get 3 and the last third is empty.
How I can fix it so that only the necessary pages have not an extra that is empty?