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”
Leave a Reply
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.
Usually it’s in header, sidebar, or footer. Just insert the code to the php file.