Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
that's it. thank you :) –  Alex Nov 26 '10 at 5:34
    
You are welcome! –  sorich87 Nov 26 '10 at 7:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.