[wp-hackers] Threaded Comments

Owen Winkler ringmaster at midnightcircus.com
Wed Oct 27 05:18:28 UTC 2004


Mark Jaquith wrote:

> I'm fairly certain that it can be done with a plugin + replacement 
> wp-comments.php file.  Now that we can hook in to comment_post in 
> wp-comments-post.php, that portion can be handled with a plugin.  
> Check for the "parent comment" value, and if set, update the comment 
> in the DB with that info.  Then the new wp-comments.php file can take 
> care of making sense of the parent > child relationships and display 
> the comments accordingly.

Just thinking out loud...  You're not replacing the wp-comments.php 
file, right?  You're creating a new file and including that from a 
function like threaded_comments_template(), which would be called 
instead of comments_template().  Because then you'd only need to change 
one line in the template to get the threads, and upgrades wouldn't 
overwrite your changes.  Of course, this would only apply to 1.3.

A cheesy way to do it with javascript would be to add script output from 
the plugin to rearrange the parent containers of comments so that they 
display as threaded.  Then you wouldn't need to do anything but activate 
the plugin.  But that's using javascript on the post pages, which I 
don't even like that much.

Also, wp-comments.php comes along for the ride in a theme as 
comments.php.  So you could conceivably create a theme to output 
threaded comments, as long as the funcions to capture the parent data 
could be built into the theme or combined with a plugin somehow.

It would be kind of neat to be able to package plugins with a theme if 
they are required.

Maybe you've all thought of this already.

Owen





More information about the hackers mailing list