Mostrar ‘últimos comentarios’ en Wordpress
Posted February 26th, 2007 by Pere TufetSi tienes un blog en Wordpress y quieres mostar los últimos comentarios, tal y como lo tengo en este blog…

…solo tienes que añadir este código en el fichero sidebar.php en el lugar que quieras que aparezcan.
<?php
if( $comments = $wpdb->get_results(
"SELECT comment_author, comment_author_url,
comment_ID, comment_post_ID
FROM $wpdb->comments
WHERE comment_approved = '1'
ORDER BY comment_date_gmt DESC LIMIT 15") ) :
?>
<li><h2>Últimos comentarios</h2>
<ul>
<?php
global $comment;
foreach ($comments as $comment) {
echo '<li><b>'
. get_comment_author_link() . '</b> - '
. '<a href="' . get_permalink($comment->comment_post_ID)
. '#comment-' . $comment->comment_ID . '">'
. get_the_title($comment->comment_post_ID)
. '</a></li>';
}
?>
</ul>
</li>
<?php endif; ?>
Vía: Piedra-Papel-Tijera
Filed under:Wordpress
3 Responses to “Mostrar ‘últimos comentarios’ en Wordpress”
August 31st, 2007 at 15:48
Genial, muchas gracias, me ha sido muy útil, lo acabo de implantar en mi blog y va perfecto.
September 8th, 2007 at 12:19
Muchas gracias por compartir el conocimiento. Acabo de modificar el sidebar de mi blog y queda de maravilla.
Saludos
October 14th, 2007 at 9:10
Ha funcionado a la perfección. Gracias!
Deja un comentario