[wp-hackers] Comment Abstraction

David Chait davebytes at comcast.net
Fri Jan 13 16:06:59 GMT 2006


would also make it possible to replace comments with say forum posts, 
transparent under the hood without changing a line of template/theme code.

----- Original Message ----- 
From: "Owen Winkler" <ringmaster at midnightcircus.com>
To: <wp-hackers at lists.automattic.com>
Sent: Friday, January 13, 2006 8:48 AM
Subject: [wp-hackers] Comment Abstraction

| While working on a project recently, I noticed that although there are
| many functions for abstracting post fetching from queries, there are
| none for doing this with comments.
| For example, functions like get_posts() let you fetch a set of posts.
| An entire class, WP_Query, has features for retrieving posts without a
| developer having to write any SQL.  And in among those functions and
| classes there are a dozen plugin hooks for altering what they return.
| Conversely, comment retrieval is primarily accomplished using SQL
| queries.  As such, hooks for modifying what they return would need to be
| inserted wherever a query was executed.
| The method for retrieving comments using a template's comments.php is
| not so transparent, either.  A variable, $comments, simply shows up out
| of seemingly nowhere to provide the comments for a post.
| My suggestion as a core enhancement for 2.next is to provide abstraction
| functions and a first-pass set of plugin hooks to filter comments.
| Anyone else have opinions on this?
| Owen

More information about the wp-hackers mailing list