#11550 closed feature request (worksforme)
Assign Categories to Static Pages
Reported by: | westonruter | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch reporter-feedback 2nd-opinion |
Focuses: | Cc: |
Description
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:
- 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).
- 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)
- Archive pages would be available under category page and would be restricted to posts in the category: /news/2009/12/ => /about/news/2009/12/
- 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.
Attachments (1)
Change History (16)
#1
@
15 years ago
I have to ask back:
I have a post "CAR" which is in the "NEW" category. And the "NEW" category has a category-page assigned. Then I get:
- A category-page I can request as /new/
- That category-page does a listing of all posts in that category
- Pre-Fixed posts-URLs, like /new/car/ for the post "CAR"
Does these assumptions fit for your concept?
#2
@
15 years ago
- Keywords has-patch reporter-feedback 2nd-opinion added; wp_rewrite permalinks categories static pages wp_list_pages category_link post_link removed
#3
@
15 years ago
@hakre: Yes. Whatever the permalink structure is for posts would be valid after the page name, if it begins with %category%. So if the permalink structure is: /%category%/%year%/%monthnum%/%postname%/
Then the "Car" post placed into the "New" category (which is assigned to a static page), the URI would be: /new/2010/02/car/
Archive pages would be accessible via appending the date to the category page URI:
'New' posts by month: /new/2010/02/
'New' posts by year: /new/2010/
#4
@
15 years ago
- Milestone changed from 3.0 to Future Release
This wasn't a feature we agreed to include in 3.0 when we determined scope. Taxonomies for pages is important, but I don't think we should try to squeeze it into 3.0... we agreed 3.0 would focus on the merge, custom post types and menu management. Since taxonomies on pages has a big effect on users, I don't feel comfortable putting it in without doing testing and considering it in relation to other taxonomy stuff. I'm changing the milestone to future release so that you can keep working on it without it distracting from the 3.0 dev effort.
#7
follow-up:
↓ 8
@
15 years ago
- Owner filosofo deleted
- Status changed from new to assigned
That's weird. I changed the component to taxonomy, but I definitely didn't add filosofo as owner. I have no idea why that is saying I did, so I'm removing filosofo as owner since it looks like some weird Trac bug.
#8
in reply to:
↑ 7
@
15 years ago
Replying to janeforshort:
That's weird. I changed the component to taxonomy, but I definitely didn't add filosofo as owner. I have no idea why that is saying I did, so I'm removing filosofo as owner since it looks like some weird Trac bug.
Some of us get certain components by default. You can see the complete list here.
#9
@
15 years ago
Since pages are nothing more than a post type, then how much of this ticket is fixed with this attached to the init hook:
register_taxonomy_for_object_type( 'category', 'page' );
#11
@
14 years ago
i was waiting for 6 months to get the patch into WP 3.0. Can sameone tell me when i can use that functionality ??
Theme customizations to get categories mapped to static pages and posts to appear under them.