WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Catch the total number of posts in the whole Blog (3 posts)

  1. Maujor
    Member
    Posted 8 years ago #

    How to to catch into a PHP variable the total number (an integer of course) of posts in the Blog (Sum of posts in all categories)
    Something like this:

    '<?php $total_posts = ???? ?>'

  2. pizdin_dim
    Member
    Posted 8 years ago #

    Try this:

    <?php $total_posts = $wpdb->get_var("select count(id) from $wpdb->posts"); ?>

  3. Maujor
    Member
    Posted 8 years ago #

    Thank you pizdin_dim :-)
    Works great!

Topic Closed

This topic has been closed to new replies.

About this Topic