[wp-trac] [WordPress Trac] #12105: Add support to get_single_template() for custom content types
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 1 00:22:49 UTC 2010
#12105: Add support to get_single_template() for custom content types
-------------------------+--------------------------------------------------
Reporter: ptahdunbar | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.0
Component: Template | Version: 3.0
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
Comment(by nacin):
I think it would be best to have all single.php point to a new
singular.php base (or post-type.php base).
The existing hierarchy would then become the following. Attachments:
{{{
{mime_type}.php
singular-attachment.php (new)
attachment.php
single.php
singular.php (new)
}}}
Posts:
{{{
singular-post.php (new)
single.php
singular.php (new)
}}}
Pages:
{{{
(custom template).php
singular-page-{slug}.php (new)
page-{slug}.php
singular-page-{id}.php (new)
page-{id}.php
page.php
singular.php (new)
}}}
Then a new branch would be:
{{{
(custom template).php
singular-{type}-{slug}.php
singular-{type}-{id}.php
singular-{type}.php
single.php
singular.php
}}}
Obviously my thought is that is_singular_template() could handle a lot of
that before passing it off to the corresponding function (or just merge
all three and have the other three call this one).
We've yet to incorporate ids and slugs into single.php lookups and that is
probably for performance reasons and because it wouldn't be used that
much.
To answer greenshady's comment which just came in as I was about to submit
this:
> I removed singular- from the beginning so this would match how pages are
currently done.
Not prepending something could cloud the namespace a bit and possibly
conflict with existing templates.
Also, having get_singular_template() below get_single_template() would
always cause single.php to be used as that currently catches all custom
post types. Really we just need to make sure we're adding on functionality
in the right order, and newer and more specific templates should replace
older and more general ones if available.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12105#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list