Always Forward

Displaying Total Number of Posts and Comments on the WordPress Website

Notice

This post was auto-translated with Google Translate, and I will proofread it in the upcoming weeks.
This post is over 5 years old, and may not reflect the author’s current view.

If you want to display the total number of categories, articles and comments anywhere on your site, these codes will be useful for you. I haven’t been able to post consistently on my site for months now. I didn’t post much on social media either. However, I put these codes in the footer section of my site. Both to see the initial state of my site thoroughly and comfortably and to give general information about the site.

If you want something like this;

always ahead her zaman ileriye blog wordpress Tasarim1 Sitedeki Toplam Yazı ve Yorum Sayısı Gösterme

Bu kodları istediğiniz, uygun bir yere yerleştirebilirsiniz.

<!–?php   $args=array(   ‘orderby’ =–> ‘name’,
‘order’ => ‘ASC’
);
$categories=get_categories($args);
$cat_count = 0;
foreach($categories as $c) {
$cat_count++;
}
$count_posts = wp_count_posts();
$published = $count_posts->publish;
?>
Sitemizde<strong><!–?php echo $cat_count; ?–></strong> kategoride<strong><!–?php echo$published;?–></strong> adet yazı yazılmış ve<strong><!–?php echo $wpdb—>get_var(“SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = ‘1’”);?></strong> yorum bulunmaktadır.

It is that simple to show the total number of posts and comments on our site. See you in another post 🙂

Kerem Mete

Hi, I am a seasoned SEO specialist with 10 years of experience driving organic growth and developing effective SEO strategies. Currently, I am working as a Sr. SEO Manager in Digitas in the UK. For more details, check out my about me page.

Related Articles

Leave a Reply

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

Back to top button