Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Templates are not being picked up across the Scheme #14

Open
BoweFrankema opened this issue Apr 27, 2012 · 2 comments
Open

Page Templates are not being picked up across the Scheme #14

BoweFrankema opened this issue Apr 27, 2012 · 2 comments
Assignees
Labels

Comments

@BoweFrankema
Copy link
Contributor

At the moment Page Templates are not being picked up across the theme. Grandchild Themes pick up templates from Infinity just fine, but it skips the child theme page templates.

Apparently there is a filter on the function that retrieves the page templates:

http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/theme.php#L917

This post on Stackexchange contains some extra pointers on how this can be used in practice:

http://wordpress.stackexchange.com/questions/3396/create-custom-page-templates-with-plugins/3558#3558

@ghost ghost assigned MrMaz Jul 3, 2012
@MrMaz
Copy link
Member

MrMaz commented Jul 19, 2012

I have some bad news man. I just spent 90 minutes looking into this, and as of 3.4.1 this is not possible. The page template must exist in the root theme (aka. "template") or the active theme (aka. "stylesheet"). Any theme in the meat of the stack can't have page templates.

I found the exact code which locates page templates, and there is no filter anywhere even close. There might be this crazy backdoor way to inject a list of page templates directly into the wp cache, which is where the page templates are stored, but that just seems really risky. Maybe if this becomes a major issue we can add it as experimental code which gets flipped on with a constant or something.

Here is the WP file/line where page templates are grabbed and cached: http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/class-wp-theme.php#L920

So anyways, leaving this open, but punting to future release for now.

@MrMaz
Copy link
Member

MrMaz commented Apr 30, 2014

Ok, so there is finally a filter! But it doesn't have anything to do with paths, and you can't add more templates. There may be additional filters higher up the call stack, so more investigation is needed.

Here is the file/line on the WP 3.9 branch:
https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/class-wp-theme.php#L982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants