Skip to content

Instantly share code, notes, and snippets.

@hasanm95
Created September 1, 2016 16:16
Show Gist options
  • Save hasanm95/4c267c29237ab3a6d602e66c45c8f610 to your computer and use it in GitHub Desktop.
Save hasanm95/4c267c29237ab3a6d602e66c45c8f610 to your computer and use it in GitHub Desktop.
Wordpress comments list for homepage
<ol class="commentlist">
<?php
//Gather comments for a specific page/post
$comments = get_comments(array(
'status' => 'approve' //Change this to the type of comments to be displayed
));
$args = array(
'walker' => null,
'max_depth' => '',
'style' => 'div',
'callback' => null,
'end-callback' => '',
'type' => 'all',
'reply_text' => '',
'page' => '',
'per_page' => '',
'avatar_size' => '',
'reverse_top_level' => null,
'reverse_children' => '',
'format' => 'html5',
);
//Display the list of comments
wp_list_comments($args, $comments);
?>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment