[wp-trac] [WordPress Trac] #13265: Filter results of get_page_templates()
WordPress Trac
wp-trac at lists.automattic.com
Wed Feb 1 05:26:23 UTC 2012
#13265: Filter results of get_page_templates()
-------------------------+-----------------------------
Reporter: nathanrice | Owner: nathanrice
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+-----------------------------
Comment (by johnjamesjacoby):
Replying to [comment:14 nacin]:
> This won't be enough to make this work. You'd also have to filter
get_page_template() (via the {$type}_template filter in
get_query_template(), with $type being 'page'), because the
validate_file() check in get_page_template() will fail.
>
> Selecting a special template doesn't help much when the template loader
can't do anything with it.
bbPress 2.0/2.1 both have functions to do everything except filter
get_page_templates(). I stopped short of that, because it simply was not
possible to do.
It's neigh impossible to accurately guess the mark-up needed to match a
header/body/footer in a cookie-cutter page template; twentyeleven and
twentyten are different enough where the same 1 page template will not
work with both themes. As it stands, I'm not convinced that putting a
filter on get_page_template() actually will solve the problems outlined
here; maybe for parent/child themes, or for creating some kind of "theme
compatibility pack" for each specific theme where functionality can be
almost guaranteed.
> In order to back a patch like this, it would be great seeing a plugin
uploaded here that then implements something using it. That way we know
we're doing it correctly. If that happens soon this is something that can
make it into trunk after some review.
See: [http://bbpress.trac.wordpress.org/browser/branches/plugin/bbp-
includes/bbp-template-functions.php bbp-template-functions.php] for the
functions needed to bypass !WordPress limitations.
See: [http://bbpress.trac.wordpress.org/browser/branches/plugin/bbp-
includes/bbp-template-loader.php bbp-template-loader.php] to see how
bbPress mirrors !WordPress's template loader.
See: [http://bbpress.trac.wordpress.org/browser/branches/plugin/bbp-
includes/bbp-theme-compatibility.php bbp-theme-compatibility.php] to see
how bbPress shoehorns itself into existing themes.
Even with !WordPress core filters, the functions bbPress uses still need
to exist; instead they would filter existing !WordPress core functions
that currently lack filters. The filters you mention above would make it
easier for plugins to ship working templates or template parts with their
new functionality without needing to write custom template loaders.
If anyone is looking to incorporate a patch for !WordPress core and is
unsure where to start, I'm happy to provide some direction and support.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13265#comment:17>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list