[wp-trac] [WordPress Trac] #12267: Upgrade loop objects to provide identical presentational interfaces.

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 18 00:36:58 UTC 2010


#12267: Upgrade loop objects to provide identical presentational interfaces.
-------------------------+--------------------------------------------------
 Reporter:  andy         |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  General      |     Version:            
 Severity:  normal       |    Keywords:            
-------------------------+--------------------------------------------------

Comment(by andy):

 wp-classes.diff: this works, as far as creating the objects and some of
 the methods. Not all of the methods are tested and more must be added.
 (They certainly should be cleaner, more filtered, better coded, etc.) I'm
 using it right now with a search plugin that does something uncommon. The
 query gets wp_posts.* and wp_comments.* and returns data like this:

 ||ID||post_title||post_type||...||comment_ID||comment_post_ID||comment_author||
 ||1||Welcome||post||...||NULL||NULL||NULL||
 ||NULL||NULL||NULL||...||1||1||Mr. !WordPress||
 ||2||A Page||page||...||NULL||NULL||NULL||

 This is how results can be mixed from two separate tables. (It's also why
 tables should never include the same column name!) These rows are
 correctly converted into the wp_post or wp_comment classes because the
 NULL value causes `isset($post->post_type)` to return false.

 With a few modifications to the loop template I was able to get comments
 to appear in the same loop with posts.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12267#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list