<?php // display latest comments for each post on non-single page views
$comment_array = array_reverse(get_approved_comments($wp_query->post->ID));
$count = 1; // number of comments
if ($comment_array) { ?>
<h3><?php comments_number('No comment', '1 comment', '% comments'); ?></h3>
<ul>
<?php foreach ($comment_array as $comment) {
if ($count++ <= 2) { ?>
<li><?php comment_author_link(); ?>: <?php comment_excerpt(); ?></li>
<?php }
} ?>
</ul>
<?php } else {
echo '<p>No comments yet.</p>';
} ?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.