[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
Wed Mar 6 22:41:50 UTC 2013
#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: Template | Release
Severity: normal | Version:
Keywords: has-patch westi-likes needs-unit- | Resolution:
tests |
-------------------------------------------------+-------------------------
Comment (by chipbennett):
Replying to [comment:56 nacin]:
> I think this is one of those situations where it is so close but we
don't have it. The feature doesn't quite know what it wants to do, what it
is supposed to do, or where it should be used. From IRC:
>
> * "my original use case was for overriding images and JS in a child
theme, but i can see that it could potentially introduce bad practices in
child themes" (johnbillion)
> * "I'm currently in punt because it keeps getting more weird and
awkward" (westi)
> * "I think the original idea was great, but it just seems to open the
door for too much strange/bad practice" (westi)
> * "I'm ok with punting, i use my own version of the function in my own
themes anyway" (johnbillion)
My preference would be to limit the function to return a file URL: i.e. a
function that is analogous to `locate_template()`, except that it doesn't
try to load anything, and simply returns either
`get_stylesheet_directory_uri() . '/' . $file` or
`get_template_directory_uri() . '/' . $file`. I could attach the patch I
was going to submit, but I think it's covered in the latest diff already.
My naming preference would therefore also be: `theme_file_uri()`, rather
than `theme_url()`. The latter is confusing, because it implies that the
function is return the URL of the ''Theme'', rather than the URL of a
''file'' contained in the Theme.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18302#comment:64>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list