comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT 5";
$comments = $wpdb->get_results($sql);
foreach ($comments as $comment) {
$output .= "
ID) . "#comment-" . $comment->comment_ID . "\" title=\"Comentario en " . $comment->post_title . "\">" . ucfirst(strtolower(strip_tags($comment->com_excerpt))) . "..." . $comment->comment_author . "\n\t";
}
echo $output;
}
// Total de post
function stats_post() {
global $wpdb;
return (int) $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->posts . ' WHERE post_status = "publish" AND post_type = "post"');
}
// Total de comentarios
function stats_comentarios() {
global $wpdb;
return (int) $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->comments . ' WHERE comment_approved = "1"');
}
// Total de suscriptores
function stats_suscriptores_feedburner($mifeed) {
/*
$url = "https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=$mifeed";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
if ($data) {
preg_match('/circulation=\"([0-9]+)\"/',$data, $matches);
if ($matches[1] != 0)
$fb['count'] = $matches[1];
$fb['lastcheck'] = mktime();
update_option("feedburnersubscribecount",$fb);
}
$feed = $fb['count'];
return $feed;
*/
}
// Total de trackback
function stats_trackback() {
global $wpdb;
return (int) $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->comments . ' WHERE comment_type = "pingback"');
}
// Total de tags
function stats_tags() {
global $wpdb;
return (int) $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->terms . ' INNER JOIN ' . $wpdb->term_taxonomy . ' ON ' . $wpdb->terms . '.term_id = ' . $wpdb->term_taxonomy . '.term_id WHERE ' . $wpdb->term_taxonomy . '.taxonomy = "post_tag"');
}
// Remplazar [...] en el excerpt por defecto
function new_excerpt_more($excerpt) {
$excerpt = str_replace('[...]', '...', $excerpt);
return $excerpt;
}
add_filter('wp_trim_excerpt', 'new_excerpt_more');
function new_excerpt_length($length) {
return 40;
}
add_filter('excerpt_length', 'new_excerpt_length');
?>