Marcus
Avatar Marcus
Themenersteller
Guru (224 Beiträge)

Nach Theme-Wechsel keien Gravatare der Top-Kommentatoren

am 04.07.2015, 11:53 Uhr eröffnete Marcus folgenden Thread
Wordpress    1591 mal gelesen    2 Antwort(en).

Hallo zusammen!

Mit folgendem Code habe ich eine Wall-of-Fame meiner Top-Kommentatoren gebastelt:

function top_commentator_all() {
global $wpdb;
$i = 0;
?>


<?php $topcommentator_query="SELECT comment_author, comment_author_email, comment_type, SUBSTRING_INDEX(REPLACE(comment_author_url, 'www.', ''), '/', 3) as top_commentator, COUNT(*) as top_num FROM $wpdb->comments
WHERE comment_approved='1'
AND comment_author_url IS NOT NULL
AND comment_author_url != ''
AND comment_author_email NOT LIKE '@themenfreund.de%'
AND comment_author_url NOT LIKE 'http://facebook.com/%'
AND comment_author_url NOT LIKE 'http://themenfreund.de%'
AND comment_author_url NOT LIKE 'http://twitter.com%'
AND comment_type NOT LIKE 'pingback' OR 'trackback'
GROUP BY top_commentator
Order by top_num DESC, comment_date ASC
LIMIT 18";
$topcommentator_result = $wpdb->get_results($topcommentator_query);
if ( !empty($topcommentator_result) ) {
foreach ($topcommentator_result as $comment) :
$co_aut = $comment->top_commentator;
$co_aut = str_ireplace("http://", "", $co_aut); ?>





<?php
echo $comment->comment_author.'
';
?>


<?php
echo $comment->top_num.' Kommentare'; ?>



<?php
$i++;
if($i%3==0) { ?>
<?php
}
endforeach;
$i=0;
}
?>


<?php
} ?>

Spätestens seit einem Themewechsel werden die Original-Gravatare nicht mehr angezeigt.

Jemand eine Idee, woran das liegen kann?


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

matthes
Avatar matthes
Foren Moderator
Evil Genius
Content Halbgott (973 Beiträge)
am 04.07.2015, 15:18 Uhr schrieb matthes

Du siehst nach dem Erstellen des Beitrags doch, wie unleserlich das ist.
Bearbeite den Beitrag, füge Umbrüche ein und ermögliche es uns so, ohne größeren Aufwand zu helfen.

So muss das doch nicht sein.

PS: Und weil ich es ja doch tue... Die Funktion get_avatar kann von Plugins und Themes überschrieben werden. Schau mal, ob dein Theme das tut. Eventuell benötigt es die Daten dann anders.
Die Lite-Version des Themes verwendet get_avatar($comment->comment_author_email,164) statt des ganzen Objekts, das würde ich auch versuchen.


Make Seitenreport great again!

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 04.07.2015, 15:40 Uhr schrieb Marcus

Hallo Matthes!

Sorry für die Darstellung und Danke für den Änderungsvorschlag, der führte genau zum Ziel


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

  • 1


« zurück zu: Wordpress

Das Seitenreport Forum hat aktuell 5273 Themen und 36107 Beiträge.
Insgesamt sind 48345 Mitglieder registriert.