[wp-trac] [WordPress Trac] #11550: Assign Categories to Static Pages

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 21 21:09:26 UTC 2009


#11550: Assign Categories to Static Pages
-------------------------+--------------------------------------------------
 Reporter:  westonruter  |       Owner:                                                                                           
     Type:  enhancement  |      Status:  new                                                                                      
 Priority:  normal       |   Milestone:  3.0                                                                                      
Component:  General      |     Version:                                                                                           
 Severity:  normal       |    Keywords:  wp_rewrite, permalinks, categories, static pages, wp_list_pages, category_link, post_link
-------------------------+--------------------------------------------------
 I have identified my most frequently-written theme customization:
 assigning categories to static pages so that they appear in wp_list_pages,
 as well as making in_category() posts appear on this category page and
 under it in the URI structure. Something similar is already possible in
 the Reading Settings where you can assign a static page to be the "posts
 page", but this applies to all posts in all categories and it does nothing
 to the permalinks for posts.

 My suggestion:

 1. For each category in the admin, provide a new dropdown option for
 selecting a static page to use for the category template, say a "News"
 category assigned to a "About > News" page (/category/news/ =>
 /about/news/). The environment on this invoked page template would be very
 similar to when is_posts_page. The WP_Query for this page would be for all
 posts in the category, and the template would have to have a loop for
 iterating over them (would default to category.php not page.php).

 2. Posts in a category which is assigned a static page would appear under
 that page's page_uri. For example, instead of /news/2009/12/hello-world/
 it would appear as /about/news/2009/12/hello-world/ (and attempting to go
 to the first would 301 redirect to the latter)

 3. Archive pages would be available under category page and would be
 restricted to posts in the category: /news/2009/12/ =>
 /about/news/2009/12/

 4. When viewing a singe post in the category, wp_list_pages would add a
 current_page_ancestor class to the category page item.

 See attached code for some of what I end up doing for almost every
 WordPress site I implement.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11550>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list