Simple wordpress plugin to show/hide comment replies, rather than have them all listed. An options page makes it really easy to change different parts of your comment calls.
Features
This keeps the default “wp_list_comments()” features. The only difference is that the child comments will have the added “<div class='children'>” added to it (ol and ul already have this class by default). A clickable span that triggers the action to expand the replies is also added. Pagination and level depths are not affected.
New features are including easing options, as well as allowing images. An options page has been added for further customizations, making it even easier to use.
- Unzip the package.
- Upload to your wordpress plugins directory.
- Go to “Plugins” and activate.
- Open up your comments.php file (in the theme you are using) and replace “
wp_list_comments()” with “bb_list_comments()“.
Options Page
The items you can mess with here will edit the arguments for wp_list_comments(), so you no longer need to add arguments to your call. In fact, if you have arguments in your bb_list_comments call, they will be ignored (but if they are there, it won’t break anything). The only sections to comment on (because they are not a part of the Codex) are:
- Show Replies Text/Hide Replies Text. These items are the text you set for the show/hide links. If you want to use an image in place of (or with) the text, then use CSS to pull that off (this example has the image, named “sprite.png”, uploaded to the theme’s images directory). An example:
.replylink span {
display:inline-block;
background:url("images/sprite.png") no-repeat left top;
width:20px;
height:20px;
overflow:hidden;
line-height:50px; /* make text disappear */
}
-
Slide Speed (both open and close). This is the speed of the animation for opening and closing the replies. You can use “fast” or “slow”; or set how long (in milliseconds) you want the animation to take.
-
Easing Type. The jQuery Easing wordpress plugin has been added so you have more animation options. Simply choose which animation you want to use, and it will be applied to both the opening and closing of replies.
I’ll also comment on the “callback” section – it is discussed in the codex, but there’s no example of how to use it. If you want to format the layout of your comments, then you need to use a callback function to rearrange the HTML. This wordpress plugin comes with a callback function you can use. It’s NOT set as the default. If you’d like to use it, enter in bb_jcr_format_comment to this text field, and your comment layout will use the callback supplied in the wordpress plugin. if you still want to edit the layout, feel free to copy the function (located within jQuery-comments.php, around line 323) and paste it into your theme’s functions.php file. You WILL have to rename the function, or you’ll get a fatal error. Once you rename the function, take that name and pop it into the “callback” field on the settings page, then feel free to edit the function to get the exact layout you want to have.
There’s several tutorials availble for how to edit the comment layout, but Jeremy Clark‘s is the one that actually started this wordpress plugin.
