开发者

Enqueuing a script before anything else in WordPress

I wondered if it was possible to change the order in which a script is enqueued.

I ask this because I wish to include the HTML5 enabling script but it needs to be included before any styles.

Is there any way to change the order?

I could obviously hard code it into the themes header, but I would prefer to enque开发者_如何学Cue it.

Thanks for any suggestions you may have.


By default, WordPress writes out enqueued styles before it writes out enqueued scripts. This is actually a good idea in the web design world because the styles are needed to render the page and should be downloaded before anything else that will block that (if you're waiting for a large script download before styles are loaded, the user will be presented with an ugly, unstyled page).

If you need to include something out of this order, hard-coding it before any styles or the call to wp_head() would be the easiest way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜