<?
// Toplam yazi sayisi
function get_totalposts() {
global $wpdb;
$totalposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'publish'");
return $totalposts;
}
// Toplam yorum sayisi
function get_totalcomments() {
global $wpdb;
$totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = '1'");
return $totalcomments;
}
// Farkli nicklerden gelen yorum sayisi
function get_totalcommentposters() {
global $wpdb;
$totalcommentposters = $wpdb->get_var("SELECT COUNT(DISTINCT comment_author) FROM $wpdb->comments WHERE comment_approved = '1'");
return $totalcommentposters;
}
// Toplam link sayisi
function get_totallinks() {
global $wpdb;
$totallinks = $wpdb->get_var("SELECT COUNT(link_id) FROM $wpdb->links");
return $totallinks;
} ?>
kodlarını ekledikten sonra
- <b><?=get_totalposts()?></b> yazı mevcut
- <b><?=get_totalcomments()?></b> yorum mevcut
- <b><?=get_totalcommentposters()?></b> farklı isimden yorum mevcut
gibi gösterimlerini yapabilirsiniz.