I feel like I’ve coded something that already exists – I just couldn’t find it.
I sometimes need to include just a few lines of javascript or css, and I don’t like have to bundle an extra file to do that. So, I’ve just created a small set of functions that will (hopefully) make it easier for me to enqueue these little bits of script.
[zip id=1260]
Notes
Also, if copying the code directly from this post, it may be incorrectly unescaping a few characters. I recommend using the download.
Bugs or Suggestions?
Let me know in the comments, or catch me on twitter (@trepmal).
I simply include the bit of script in the template just before the call to get_footer(). The downside to your approach is you need to run PHP for each request to the "static" resource.