How to Count Post from a Website

Mini Bytes: If you want to count total number of post from a website, then you should know some programming knowledge. Otherwise you can skip this article.

So, How to count total number of post from a website. You can count the total number of post from a website using a simple query that will fetch the result from a function.

I am talking about the WordPress, yes only in wordpress you use PHP programming and i can only do programming in the PHP. I am not a specialist in programming but by following some of the forums allow me to get some information about how to count post that was stored in your database.

WordPress has more inbuilt functions that are stored inside the “include” folder in your hosting account web space. If you need to check the functions then you will need a day to go through the name of the function from wordpress website.

Check out the function list from the WordPress Functions¬†website. There you have all the functions which are need to run the wordpress website. After seeing this post, don’t try to edit any of your functions in your wordpress library. Editing or modifying the code in the library will disable your access to wordpress site.

Here i have give the code, that was used to calculate the count of the wordpress post.

Use the following code to count your number of post in your website. The below mentioned function will count all the post and return it into an array. So i have mentioned the addition part that was used to count the post and echo the result.

$count += wp_count_posts();
echo $count;

The code given above will count the post but will not throw the output, you need to write remaining code to display the output of the code. You can use “echo $count” as the next line and try to run the php.

You can also check out the WordPress Count Post link to get a detailed information about the function wp_count_post().

Please comment and leave feedback.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *