Hallo zusammen!
Mit folgendem Code lasse ich bei mir die Letzten Kommentare inkl. Gravataren anzeigen:
PHP
global $wpdb, $comments, $comment;
if ( !$number = (int) $options['number'] )
$number = 5;
else if ( $number < 1 )
$number = 1;
else if ( $number > 15 )
$number = 15;
$comments = $wpdb->get_results("SELECT comment_type, comment_author, comment_author_email, comment_author_url, comment_ID, comment_post_ID, comment_content FROM $wpdb->comments
WHERE comment_approved = '1'
AND comment_type
NOT LIKE 'pingback' OR 'trackback'
AND comment_author_url NOT LIKE 'http://domain/account'
ORDER BY comment_date_gmt
DESC LIMIT $number");
if ( $comments ) {
foreach ($comments as $comment) {
echo '<li style="list-style-type:none">'. get_avatar( $comment, 32) .'<div class="meta">' . sprintf(__('Von %1$s in: %2$s'), get_comment_author_link(), '<br /><a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '" rel="follow me" title="'.get_the_title($comment->comment_post_ID).'">' . get_the_title($comment->comment_post_ID) . '</a></div>') . '<p>', comment_excerpt() ,'</p>';
echo '</li>';
}
}
}
Alles anzeigen
Wie kann ich die Gravatare jetzt mit einem Alt-Tag für die Namen (comment_author) versehen? Gleiche Frage zu den Namen, die mit
ausgegeben werden.
Danke im voraus