[wp-trac] [WordPress Trac] #43379: Allow themese to know if they are the parent or child theme
WordPress Trac
noreply at wordpress.org
Wed Feb 21 15:52:02 UTC 2018
#43379: Allow themese to know if they are the parent or child theme
-----------------------------+-----------------------------
Reporter: denvercoder9 | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version:
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
I've seen a few tickets from a long long time ago that would have
potentially provided the functionality, however the solutions introduced
were designed to solve completely different problems.
It would be convenient for a parent theme to know it's a parent or a child
theme to know it's a child.
For example if I was to create a theme that was intended to support
parent/child theme functionality but was also built around specific
conventions.
As an example for a theme there is a config.php file that should be loaded
for both paren/tchild, the configurations in this file would be different
for each theme. Let's suppose there are a lot of conventions like this and
I want the themes to automatically load different files without requiring
the person setting up the child theme to update all instances of
get_template_directory() with get_stylesheet_directory(). Maybe as another
example is maybe the parent them provides a file for hooking into gravity
forms if it exists. As a convention I would like the child theme to
organize it's code in a similar way and specific file is used to for
gravity forms hooks.
I think this could be solved in a variety of ways. Possibly providing a
way to scope variables to a specific theme.
Or to create a utility function to identify if the current working theme
is currently active. As I understand it code from a theme should only be
running if it is a parent theme or a child theme. If the current working
file is not in the active theme than it would inherently be a parent theme
file.
While there is the ability to provide workarounds, the only ways I have
identified often require expensive file system calls, which I'm hoping,
with my limited knowledge of how core handles parent/child a solution
could be introduced without these types of calls.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43379>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list