中文页面: /blog/post26.html
This plugin is a combination of Brian’s Threaded Comments and Keyvan’s WordPress Paged Comments Plugin. Trustin Lee has written a plugin Threaded and Paged Comments Plugin for WordPress 1.5, but the structure is complicated. I borrowed the SQL statements and functions of it, and made the two plugins work together. Now the structure is tidier, since the plugin files are put into one directory, except the comments-paged.php file.
Download(zip file, 2006-06-08)
Update:
2006-10-07:
- Fixed a bug in thread-event.js. Now afer clicking "Reply to this comment", the ‘+’ and ‘-’ pictures display as they should be.
- Fixed the array_merge problem with PHP5. Thanks to Andy.
2006-06-08:
- Fixed a bug with the updating of Threaded Comments options.
2006-06-03:
- Added a hook to delete_comment so that when the parent comment is deleted, the child gets the reply ID of it. Previously, the replies no longer display when the parent is deleted.
- Added the code to display the number of threads above comments area. See the effect below.
2006-05-24:
- Converted icon files to gif format to solve the problem that IE6 doesn’t support transparent PNG file.
Installation:
- Unzip the archive. There should be a PagedThreadedComments directory and a comments-paged.php file.
- Upload PagedThreadedComments directory to WordPress plugin directory (wp-content/plugins/)。
- Upload comments-paged.php file to the theme directory you are currently using(wp-content/themes/yourtheme/)。
- In this theme directory, edit every template file that is comments-enabled (such as single.php). And the comments_template() function call should be replaced by the following code:
if (function_exists('paged_comments_template')) paged_comments_template();
else comments_template();
- Activate Paged Threaded Comments plugin in the WordPress admin panel.
- Now the plugin should work. If the comments style does not fit your theme, modify the file thread-style.css in the plugin directory.
By default, the last page shows 10 threads, with the latest on the top. You can change this behaviour and modify other options in paged-comments-config.php. If you want to modify the max nesting level, please go to WP admin panel.
Only tested in WordPress 2.02-2.04. Any problems, please leave a comment, or directly send a mail to me.
Many people asked me how to use gravatar. Brian used $c in the comment loop, and that’s why it’s not compatible with gravatar. When time allows, I’ll modify the plugin to let it be compatible with other plugins, but for now here is a "dirty" solution:
- Extract this file to your plugins directory, and activate the plugin. This is a modified version of gravatar.php.
- Inside write-comment function of comments-paged.php, add codes like <img src=’<?php gravatar($c->comment_author_email); ?>’ />
in an appropriate place.
Of course, you need some CSS or HTML to beautify it:)