[wp-trac] [WordPress Trac] #30770: Twenty Fifteen: Theme Review: Stylesheets and Scripts
WordPress Trac
noreply at wordpress.org
Fri Dec 19 18:17:55 UTC 2014
#30770: Twenty Fifteen: Theme Review: Stylesheets and Scripts
---------------------------+----------------------
Reporter: emiluzelac | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Bundled Theme | Version: 4.1
Severity: normal | Resolution: wontfix
Keywords: | Focuses:
---------------------------+----------------------
Comment (by greenshady):
I think some people may be misunderstanding what TRT is asking. I'll
explain it in terms of code.
This line placed in `header.php`:
{{{
<script>(function(){document.documentElement.className='js'})();</script>
}}}
Should be moved to a callback hooked to `wp_head()`. I'd actually argue
both should be moved. I'm not sure how that would mess up anything with
the theme. It doesn't have anything to do with enqueueing the script.
One of the big reasons for this particular guideline to me is that child
themes (or plugins) can't remove the JS for whatever reason without
overwriting the entire `header.php`.
I do recognize that JS should be added when it's needed, not necessarily
enqueued. Hardcoding JS right in the middle of a page is sometimes valid.
But, for things that are being output directly into the header or the
footer, we should try to stick to the core header and footer hooks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30770#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list