1

I just wasted 1 day trying to make wp threaded comments works... and I think I'm finally done!!!! except that it doesn't work properly - well it doesn't work the way I want ! :)

Child comments get displayed inside the comment li - I don't like this behavior, I'd prefer wp to display it right below the parent comment li.

So by default wp handles it like this:
<li id="commend-1">
comments parent here here
<ul id="child">
<li>child comment reply :P</li>
</ul>
</li>

Anyways, I want it displayed like this:
<li id="comment-1">
</li>
<li id="comment-2" class="isreply">
</li>

Is this possible without modifying core wp files? Did wp developers leave options that enable customization of how child/nested comments are displayed?

I'm including screen shot for better visual.

https://i.sstatic.net/8PiJu.png

2 Answers 2

2

What you need is a custom Walker. You will probably use wp_list_comments() somewhere in your comments.php template file. There you can pass a walker parameter in the argument array to tell WordPress you want to style the list on your own.

This requires you to extend the Walker class. The following resources should give you some examples.

  1. Read the codex about the Walker_Class
  2. Check the sourcecode of the base class in wp-includes/class-wp-walker.php or the extending Walker_Comment class in wp-includes/comment-template.php on line 1218.
1
  • 1
    thx, I think I found a great example of doing this: sanisoft.com/blog/2010/04/05/… I just need to understand it and implement :D
    – user8842
    Commented Sep 22, 2011 at 11:12
0

Go to Settings->Discussion and disable threaded comments.

2
  • that's a good one :) I want to use threaded comments, but customize it... disabling it won't help situation :P
    – user8842
    Commented Sep 21, 2011 at 23:53
  • You could use jquery to move all nested comment underneath their parent li. Commented Sep 21, 2011 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.