Display latest comments (global) with replies on a page

Question

Trying to display the latest 50 comments (global, from all the posts) on a page (page.php)

I am using this code:

  <?php $comments = get_comments('status=approve&number=50&type=comment&hierarchical=threaded');
      foreach($comments as $comment) :?>
      <?php $post = get_post($comment->comment_post_ID, 'OBJECT'); ?>
      <li>  <a href="<?php echo get_permalink($comment->comment_post_ID);?>#comment-<?php echo($comment->comment_ID);?>">
         <?php echo $post->post_title; ?>
          </a> 
<?php echo($comment->comment_content);?> 
      </li> <br/>
    <?php endforeach; ?>

It works fine, it shows the comments, but it doesn’t show comment replies – I want to show replies too

`hierarchical=threaded` 

should do the trick, but it doesn’t. maybe because The parameter is ignored (forced to false) when $fields is 'ids' or 'counts'
But I don’t know how to fix that

thanks!

0
, , whitelord 2 years 2020-01-13T08:39:34-05:00 0 Answers 72 views 0

Leave an answer

Browse
Browse