Skip to content

Instantly share code, notes, and snippets.

@siriokun
Last active December 11, 2015 23:08
Show Gist options
  • Save siriokun/4674766 to your computer and use it in GitHub Desktop.
Save siriokun/4674766 to your computer and use it in GitHub Desktop.
<?php
while ( have_posts() ) : the_post();
if ( have_comments() )
{
echo '<ol class="comment-list">';
wp_list_comments();
echo '</ol>';
}
endwhile;
?>
<?php
$comments = get_comments( array(
'post_id' => get_the_ID(),
'status' => 'approve',
) );
if ( !empty( $comments ) )
{
echo '<ol class="comment-list">';
wp_list_comments( array(
'callback' => 'si_comment_layout',
'type' => 'comment',
), $comments );
echo '</ol>';
}
function si_comment_layout( $comment, $args, $depth )
{
?>
<li>
<div class="comment-author">
<?php echo get_avatar( $comment, 30 ); ?>
</div>
<div class="comment-content">
<?php printf( '<cite class="url fn n">%s</cite>', get_comment_author_link() ); ?>:
<?php echo strip_tags( get_comment_text() ); ?>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment