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.
What you need is a custom
Walker
. You will probably usewp_list_comments()
somewhere in yourcomments.php
template file. There you can pass awalker
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.wp-includes/class-wp-walker.php
or the extendingWalker_Comment
class inwp-includes/comment-template.php
on line1218
.Go to Settings->Discussion and disable threaded comments.