[wp-trac] [WordPress Trac] #18302: Improve child theme file inheritance by introducing `theme_url()` to locate a file URI

WordPress Trac noreply at wordpress.org
Fri Oct 31 16:35:27 UTC 2014


#18302: Improve child theme file inheritance by introducing `theme_url()` to locate
a file URI
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:  westi
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
Component:  Themes                               |  Release
 Severity:  normal                               |     Version:
 Keywords:  has-patch westi-likes needs-unit-    |  Resolution:
  tests                                          |     Focuses:  template
-------------------------------------------------+-------------------------

Comment (by greenshady):

 I'm not sure what the hangup is with this ticket.  The purpose of the
 ticket is to propose a function for loading resources (images, styles,
 scripts, etc.) from either the stylesheet directory (child theme) or the
 template directory (parent theme).  It really shouldn't do anything else.

 This function should search for a file (or an array of files) in the child
 theme, then the parent theme and return the found URI.  I proposed a
 solution that I've been using for 2 years in my themes without issues:
 https://core.trac.wordpress.org/ticket/18302#comment:65

 Basically, we want a function similar to `locate_template()` that works
 with file URIs.

 If a theme author doesn't want to allow child theme overriding for a
 particular resource (lots of good reasons not to), don't use the function.
 Simply go about using `get_template_directory_uri()` like always.

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


More information about the wp-trac mailing list