• For WP 2.0.x I had a function which returned the total number of posts and the page number for the current page (if there are more than 10 posts) that are being displayed.

    That is really useful for
    – search results: I’ve displayed something like “XX posts have been found:”
    – “Page 1 of 5 — You’re browsing category xyz, there are XX posts in this category:”

    etc.

    Could someone help me how to get this information out of WordPress 2.1?

    Many thanks,
    Bob

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter bob78

    (@bob78)

    Anyone, please? Any hint would be appreciated.

    Thanks,
    Bob

    And what did your function look like?

    As Handy notes, knowing the function or code you were using would help us suggest changes.

    Typically on category queries I call up the category’s info through the get_queried_object() function of the $wp_query class:

    <?php $category = $wp_query->get_queried_object(); ?>

    I can then display number of posts in a category (since it’s a record in the categories table) like so:

    <?php echo $category->category_count; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP2.1: How to display total number of posts being displayed?’ is closed to new replies.