Last updated on August 7th, 2022 at 07:00 pm
If you want to display total number of posts you have published on your blog or website without using any plugin then this simple code will help you.
NOTE:-If you are using this script outside wordpress, Make sure you add it after calling the WordPress header file wp-blog-header.php.
<?php $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'"); if (0 < $numposts) $numposts = number_format($numposts); ?><b><?php echo '<p><font color=black><h1>'.$numposts.' Tutorials / Scripts Published'; ?>
If you would like to display total number of comments and posts then check this How to get total posts | comments count in WordPress