Hallo zusammen!
Ich habe bei mir jetzt eine Funktion eingebaut, die die Top-Kommentatoren anzeigt.
Leider scheint da aber irgendwo ein Zählfehler zu stecken. Denn mein Top-Kommentator, bzw. in diesem Falle Kommentatorin hat keine 23 Kommentare abgegeben, sondern 'nur' 20.
Der Code sieht wie folgt aus:
PHP
function top_commentators_jahr() {
global $wpdb;
$topcommentator_query="SELECT comment_author, SUBSTRING_INDEX(comment_author_url, '/', 3) as top_commentator, COUNT(*) as top_num FROM $wpdb->comments
WHERE comment_approved='1'
AND comment_date >= CURDATE() - INTERVAL 365 DAY
AND comment_author_url NOT LIKE 'http://themenfreund.de%'
GROUP BY top_commentator
Order by top_num DESC, comment_date ASC
LIMIT 3";
$topcommentator_result = $wpdb->get_results($topcommentator_query);
if ( !empty($topcommentator_result) ) {
echo '<ul>';
foreach ($topcommentator_result as $comment) :
$co_nam = $comment->comment_author;
$co_aut = $comment->top_commentator;
$co_aut = str_ireplace("http://", "", $co_aut);
echo '<li><a href="'.$comment->top_commentator.'/" target="_blank">'.$co_nam.'</a> ('.$comment->top_num.') </li>';
endforeach;
echo '</ul>';
}
}
Alles anzeigen
Und statt des richtigen Namens wird ein Pingback-Name angezeigt.
Wie kann ich das korrigieren?
Danke im voraus!
Marcus