[wp-trac] [WordPress Trac] #22314: Add singular.php to template hierarchy

WordPress Trac noreply at wordpress.org
Fri May 1 23:20:32 UTC 2015


#22314: Add singular.php to template hierarchy
-------------------------------------------------+-------------------------
 Reporter:  chipbennett                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.3
Component:  Themes                               |     Version:  3.4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-codex needs-testing  |     Focuses:  template
  needs-refresh 2nd-opinion                      |
-------------------------------------------------+-------------------------

Comment (by obenland):

 Replying to [comment:14 johnbillion]:
 > The added template hierarchy complexity of introducing `singular.php`
 outweighs its small benefit.
 I'm not sure I agree with it making the template hierarchy more complex.
 You could also argue it makes it simpler, since the template tag has a
 corresponding template now, completing the hierarchy and not confronting
 theme authors with the special case of it missing.

 > I'm not too enthused by this. For all post types apart from Pages,
 singular.php is functionally identical to single.php (ie. it provides no
 more granular control, unlike the rest of the hierarchy). It's too narrow
 a use case to warrant introducing a new file into the template hierarchy.
 I agree, in most cases you'd probably still end up with at least two
 templates, `singular.php` and a more specialized template for either pages
 or single post, just because they are so different in their requirements.
 But it would certainly help themes to provide a default template for
 hierarchical custom post types.

 > If you want Pages to use the same template as other post types, you can
 do this by putting `include 'single.php';` into `page.php`.
 That's the reason we have so many templating possibilities in the first
 place, to avoid doing that. Working on Twenty Thirteen there was a big
 discussion about whether it should ship with an `archive.php` with a lot
 of conditionals or more specific templates for tags, categories, etc. The
 reasoning was the same, let's use the appropriate template, that's why we
 have that hierarchy in the first place.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22314#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list