[wp-trac] [WordPress Trac] #13818: There should be index pages for custom post types

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 15 07:35:07 UTC 2010


#13818: There should be index pages for custom post types
----------------------------+-----------------------------------------------
 Reporter:  frankieroberto  |       Owner:  nacin    
     Type:  task (blessed)  |      Status:  accepted 
 Priority:  normal          |   Milestone:  3.1      
Component:  Template        |     Version:  3.0      
 Severity:  normal          |    Keywords:  has-patch
----------------------------+-----------------------------------------------
Changes (by nacin):

  * keywords:  => has-patch


Comment:

 New patch does the following:

  - Adds post-type-archive and post-type-archive-{$post_type} body classes.
 For paginated post type archives, it additionally adds post-type-
 paged-$page.

  - `rewrite['feeds']` now defaults to true, instead of false. I realized
 that's probably a more common use case. `rewrite['archive']` needs to be
 true for it to work though, and it'll set itself to false if that isn't
 the case.

  - A new query flag has been introduced, is_post_type_archive, to address
 shortcomings by leaving it at is_archive. With that comes
 WP_Query::is_post_type_archive() and a wrapper is_post_type_archive().

  - I've also improved the logic that originally identified that we were
 dealing with a post type archive, by checking the queried post type's
 object to ensure we support archives. Otherwise, we fall back to is_home.
 This makes sense to me. However, that also means that the 'archive'
 parameter is no longer limited purely to rewriting (as I had said above).
 So maybe that one should come out of 'rewrite'. 'feeds' should stay,
 however.

  - get_post_type_archive_link(), get_post_type_archive_feed_link(),
 post_type_archive_title(). The last one is then used in wp_title.

 It's late and I need to get ready to leave for WCNYC, so I'm just posting
 the patch for now.

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


More information about the wp-trac mailing list