Display WordPress comments in wordpress


I was trying to figure out, how i can display wordpress comment with a help of little coding..

<div class="post-recent-comment" style="font-size: 13px; font-weight: bold; font-family: Arial,helvetica;>

<?php


$comment_array = array_reverse(get_approved_comments($wp_query->post->ID));


$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++ <= 10) { ?>


<li><?php echo($comment->comment_author . '<br />' . $comment->comment_content); ?></li>


<?php } ?>


<?php } ?>


</ul>


<?php } else { ?>


<span class="comment">No comments so far</span>


<?php } ?>


</div> 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s