「wordpress入門」ブログの情報(記事、コメント、Category、タグ数)を取得
PHPコード:
投稿数:
<?php $count_posts = wp_count_posts(); echo $published_posts =$count_posts->publish;?>
コメント数:
<?php echo $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments");?>
カテゴリー数:
<?php echo $count_categories = wp_count_terms('category’); ?>个
tag数:
<?php echo $count_tags = wp_count_terms('post_tag’); ?>
運行時間:
<?php echo floor((time()-strtotime(“2012-4-27"))/86400); ?>
最終更新:
<?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年n月j日’, strtotime($last[0]->MAX_m));
echo $last;
?>