[wp-trac] [WordPress Trac] #13239: Filter locate_template template_names variable
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 24 14:45:23 UTC 2011
#13239: Filter locate_template template_names variable
---------------------------------+-----------------------------
Reporter: chrisbliss18 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch 3.2-early |
---------------------------------+-----------------------------
Comment (by chrisbliss18):
@coffee2code,
Your last patch, 13239.c2c.3.diff, has a problem in its check for the
absolute path. It assumes that any absolute path must begin with a forward
slash. A better way to test for an absolute path is to use the
path_is_absolute() function.
@andrewlawson,
I too considered filtering a set of search paths rather than the
$template_names variable. I ended up not liking that idea as it is overly-
restrictive to the way plugins and themes can modify behavior. For
instance, the filter code must know the exact name of the template file it
wishes to provide/replace and have that file available in the non-standard
directory it has access to.
I can see this limiting at least two desirable abilities for code to use
this filter:
1. This would prevent code from providing an interface for users to select
the templates they wish to use, requiring the code and template files to
be custom-tailored for each specific application.
2. It would make it impossible for code to override ID or slug-specific
templates unless the filter code also had access to a full set of any
possible ID or slug-specific templates.
My original intent for this patch was to open up a new ways for plugins to
step in during the rendering process. Rather than limiting plugin's to
having an all-or-nothing approach to modifying the front-end, they can
have creative solutions that replace specific views or individual
components (since control over locate_template() also gives control over
get_template_part()), potentially introducing new ways for plugin and
theme devs to collaborate to create powerful tools for users without
resorting to proprietary implementations for this collaboration to occur.
Unfortunately, the patch you have produced guts most of that added value.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13239#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list