Post_count mostra solo il numero di risultati per pagina
4 dic 2012, 15:46:36
Visualizzazioni: 42.2K
Voti: 21
Ho una wp_query $wp_query = new WP_Query($args);
ma per qualche motivo il $wp_query->post_count
mostra solo il numero di post in ogni pagina. Quindi se imposto 'showposts' => '10'
e vengono trovati 12 risultati, la pagina uno mostrerà '10 risultati trovati' e la pagina 2 mostrerà '2 risultati trovati'. Perché succede questo? Non riesco a capirlo.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'showposts' => '10',
'paged' => $paged
);
$wp_query = new WP_Query($args);
echo "La ricerca ha trovato ".$wp_query->post_count." risultati";
if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();
// il loop

zilj
373
Commenti
Tutte le risposte alla domanda
1
Domande correlate
3
risposte