Make WordPress Core

Opened 8 years ago

Closed 5 years ago

Last modified 5 years 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:


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)

#1 @scribu
8 years ago

  • Milestone set to Future Release

#2 @jane
8 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.

#3 @scribu
8 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.

#4 @iseulde
5 years ago

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

#5 @helen
5 years ago

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