Afiseaza ultimele comentarii cu avatarul celui care a postat

Daca doresti sa afisezi ultimele comentarii cu avatarul celui care a postat tot ce trebuie sa faci este sa pui urmatorul cod in ce zona a template-ului vrei sa apara acesta.

[php]

<?php

$query = "SELECT * from $wpdb->comments WHERE comment_approved= ‘1’

ORDER BY comment_date DESC LIMIT 0 ,5";

$comments = $wpdb->get_results($query);

if ($comments) {

echo ‘<ul>’;

foreach ($comments as $comment) {

$url = ‘<a href="’. get_permalink($comment->comment_post_ID).’#comment-‘.$comment->comment_ID .’" title="’.$comment->comment_author .’ | ‘.get_the_title($comment->comment_post_ID).’">’;

echo ‘<li>’;

echo ‘<div class="img">’;

echo $url;

echo get_avatar( $comment->comment_author_email, $img_w);

echo ‘</a></div>’;

echo ‘<div class="txt">Par: ‘;

echo $url;

echo $comment->comment_author;

echo ‘</a></div>’;

echo ‘</li>’;

}

echo ‘</ul>’;

}

?>

[/php]

Spune si tu parerea...