/ Published in: PHP

Just the basic Wordpress comments loop.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- recent comment of each post --> <div class="recent-comment"> <?php $count = 1; ?> <?php if ($comment_array) { ?> <span class="comment"> <?php comments_number('No comment','1 comment','% comments'); ?></span> - Latest by: <ul class="commentlist"> <?php foreach($comment_array as $comment){ ?> <?php if ($count++ <= 2) { ?> <li><?php comment_author_link(); ?> <br /> <?php comment_excerpt(); ?> </li> <?php } ?> <?php } ?> </ul> <?php } else { ?> <!-- if there was no comment in that post,yet --> <span class="comment">No comment so far</span> <?php } ?> </div> <!-- end recent comment-->
Comments
