WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 8 months ago

Last modified 8 months ago

#13100 closed feature request (wontfix)

category template matches ancestor category, single post matches category filename

Reported by: jredfern Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:

Description

Dear wordpress developers,

There's two features which I think would be very useful in the wordpress template selection process. The first relates to categories - currently a category template file will be selected when the category of the selected post matches the filename of the template (category-catfoo.php). Because categories are hierarchichal (can be sub-categories) I suggest that if it can't find a template for the current category it should also also try to match ancestor template files.

The other feature which I suggest would be useful, is single post template matching using category names. For example, single-catfoo.php. This could also match on ancestor categories if none is found immediately (single-catrootfoo.php).

Best wishes,
Jim Redfern

Change History (5)

comment:1 scribu4 years ago

  • Milestone set to Future Release

comment:2 jane4 years ago

Hi Jim. The best place to make suggestions like this would be in the core features Ideas forum at http://wordpress.org/extend/ideas, so that non-developers can also weigh in. We try not to add feature request tickets in Trac until there has been some community discussion and there's a general agreement that it's something we should do, so that we can keep Trac focused on implementation rather than feature determination.

Note: You made two different suggestions in your ticket. Whether here or in the Ideas forum, it's best to create a separate ticket for each suggestion/bug report, so that they can be rated and/or handled effectively by the community.

comment:3 scribu4 years ago

I was able to achieve both types of matches using a few lines of code.

1) ancestor category template: This could cause significant overhead if you have deep nested categories.

2) single-cat template: This could cause unexpected results when a post is in multiple categories.

comment:4 avryl8 months ago

  • Keywords template selection removed
  • Resolution set to wontfix
  • Status changed from new to closed

comment:5 helen8 months ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.