最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Filter enqueued styles and scripts

programmeradmin2浏览0评论

I am looking for a way to reorganize the scripts/styles queue in WP.

I am well aware of the fact altering the queue may have undesired effects, but in this case there are solid reasons for doing it and I will be keeping the situation under control.

I did not find a native WP filter to get that done.

I need to be able to iterate over the queued items before they are printed and reorganize them based on their type (CSS or Javascript). I still want to keep them differenciated between load in head and load in footer.

How may I achieve that? I thought about creating a function that prints the styles but caches the content via PHP Output Buffer and then parsing it with PHP Dom Document.

But... there has to be a less hacky way. Any suggestions?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论