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

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 5 23:19:52 UTC 2012


#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:  3.5
Component:  Template                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch westi-likes needs-unit-    |
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by georgestephanis):

 Okay, just added 18302.9.diff

 Here's my defense for this implementation:

 IF YOU WANT:

 to use the file 'js/foo.js' that exists in the child theme, call
 theme_url( 'js/foo.js' ); -- as it will always return the child theme url
 if the file exists.  I don't think '''anyone''' would want it to return a
 url to a file that doesn't exist!

 to use the file 'js/foo.js' from the parent theme without checking the
 child theme, call theme_url( 'js/foo.js', false ); -- to skip even
 checking if a child theme exists and kick it directly to the parent theme.

 to use the file 'js/foo.js' if it exists in the child, or fall back to the
 parent  if it doesn't (allow for graceful inheritance) just call
 theme_url( 'js/foo.js' ); -- and be happy.

 I think that anyone trying to do special things if a file exists in a
 child theme are definitely out of the mainstream, and that's kinda
 overthinking the issue at hand.  Let's keep it clean, simple, and
 functional.  If someone wants to do a trapeze act, they can write their
 own function for it, as it's very much a hyperspecialized task.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18302#comment:45>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list