How to Show Total Post Count for a Blog

Posted on August 21, 2007
Filed Under WordPress Coding |

My website provides WordPress blog profiting tips. I want to show the total number of tips posted, and make the number count self-updated automatically when new posts are entered. I found the following WP tag comes handy for my purpose:

<?php the_author_posts(); ?>

I used this function to show total tip count in the subtitle of my site by modifying the header.php file. currently the subtitle is displayed by the following code:

<div class=”navbarleft”>
<?php bloginfo(’description’); ?>
</div>

It shows “One Tip a Day to Turn WordPress Blog into Cash Cow” which is what I entered as my blog description.

By add the post count function as

<?php bloginfo(’description’); ?> - <?php the_author_posts(); ?> Tips Posted

The subtitle is shown as:

“One Tip a Day to Turn WordPress Blog into Cash Cow - 15 Tips Posted”

This total post count function is useful when you’d like to display the total number entries in a website for tips, tutorials, or photos gallery.

Comments

2 Responses to “How to Show Total Post Count for a Blog”

  1. Elaine Davenport on December 15th, 2007 6:36 pm

    Hi! Can you tell me where I should put that code in order to get my Blog to show the number of posts? Thanks very much.

  2. davez on December 24th, 2007 12:20 am

    Usually it’s in header, sidebar, or footer. Just insert the code to the php file.

Leave a Reply




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word