[wp-trac] [WordPress Trac] #27322: Allow modifying the theme directory stack
WordPress Trac
noreply at wordpress.org
Sat Mar 8 04:26:07 UTC 2014
#27322: Allow modifying the theme directory stack
-------------------------+-----------------------------
Reporter: rmccue | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Keywords: has-patch
Focuses: |
-------------------------+-----------------------------
Currently, all internal functions first search the current theme's
directory for a file, then the current parent's directory. This step is
done manually in things like `locate_template`, `comments_template` and
others.
I'd like to propose adding the ability to override this stack. For plugins
that want to add default templates, they can add this to the bottom of the
stack and ensure that it works perfectly across the template loader and
other functions (such as `get_template_part`). It also allows writing
plugins to handle more complicated theme hierarchies.
WordPress itself can take advantage of this by adding the `theme-compat`
directory to the bottom of the stack, allowing fallbacks for things like
the comment template/etc without needing the custom code that currently
exists.
Note that unlike #13239, this does '''not''' allow overriding the template
hierarchy, only the theme hierarchy.
Along with this, it makes sense to introduce a `theme_url` function along
the lines of #18302. I have included that here, since it makes more sense
to bundle these changes together, IMO.
Patch attached. No unit tests currently.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27322>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list