Pergunta

I'm making a custom query for posts using something like:

$p = new WP_Query(); 
$p->query(array('offset' => 30, 'posts_per_page' => 10));

If I have 36 posts on the entire blog, $p->post_count will return the number of posts that were retrieved, 6 in this case.

I need to get the post count just like I would if I omitted this 2 arguments (so I can calculate the remaining post count). How can I do that, without making another query?

Foi útil?

Solução

The found_posts property $p->found_posts will return it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top