Display WordPress Blog Information Code

In today’s post, I share some useful WordPress code. Such as: display your posts number, comments number, website time and so on.

Display WordPress blog Information code:

1.Display Post Number

<?php $count_posts = wp_count_posts(); echo $published_posts =$count_posts->publish;?>

2.Blog Running Days

<?php echo floor((time()-strtotime("2011-7-27"))/86400); ?>

3.Total Of Tags

<?php echo $count_tags = wp_count_terms('post_tag'); ?>

4.Total Of Categories

<?php echo $count_categories = wp_count_terms('category'); ?>

5.Last Update Time

<?php $last = $wpdb->get_results("SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'post' OR post_type = 'page') AND (post_status = 'publish' OR post_status = 'private')");$last = date('Y,M,D', strtotime($last[0]->MAX_m));echo $last; ?>

Update on May 2016

Related Posts

How to check wordpress theme for malicious code