[wp-trac] [WordPress Trac] #43379: Allow themes to know if they are the parent or child theme

WordPress Trac noreply at wordpress.org
Wed Feb 21 16:50:28 UTC 2018


#43379: Allow themes to know if they are the parent or child theme
-----------------------------+------------------------------
 Reporter:  denvercoder9     |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Themes           |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by denvercoder9):

 This would not work, this just lets me know if there is a child theme in
 use which case I could just use is_child_theme(). More so Im looking for
 something that would allow functionality in a theme to know if it's
 running as the parent or the child. For example a child would have the
 ability to say "am I a parent theme? no, ok I won't run x functionality"
 or "am I a parent theme? yes, ok I will use get_template_dir instead of
 get_stylesheet_dir"

 In my example of loading files as a convention. If say for example I
 wanted to use specific glob patterns I could set a $base variable to build
 upon those patterns

 {{{#!php
 <?php
 $base = is_parent_theme() ? get_template_dir() : get_stylesheet_dir();
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43379#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list