Comments on Add META Tags, Scripts, and Stylesheets to the WordPress Header and Footer Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞. 2012-12-20T13:43:50Z http://davidwalsh.name/wp_head/feed/atom WordPress By: SpencerW SpencerW http://davidwalsh.name/?p=5610#comment-39706 2012-11-19T09:30:15Z 2012-11-19T09:30:15Z I agree with the others this is not the right approach. You should use the right enqueue command. Apart from duplication, it allows you to also specify dependencies such as jquery for your javascript.
Also performance plugins that rely on finding the js/css for a page as part of the
combination and minification process will fail.

You can limit specific code and css to a specific page or post using templates or with a plugin as already recommended above.

]]>
By: Twincascos Twincascos http://superslider.daivmowbray.com http://davidwalsh.name/?p=5610#comment-39571 2012-11-17T17:55:02Z 2012-11-17T17:55:02Z If you want to add css and js to individual posts or pages you could use my plugin perpost-code: http://wordpress.org/extend/plugins/superslider-perpost-code/ it provides a meta box on the edit screen for your css or javascript, it also provides a shortcode to display that same code into your post, check it out, you’ll love it!

I also agree with Codeforest, wp_enqueue_script and wp_enqueue_style are the way to go, especially if you are using a minify plugin, they usually only minify code and script loaded via the enqueue function

]]>
By: Codeforest Codeforest http://www.codeforest.net http://davidwalsh.name/?p=5610#comment-39570 2012-11-17T17:46:04Z 2012-11-17T17:46:04Z This definitely is not a proper way of including scripts in WordPress and should be avoided. Function wp_enqueue_script has a parameter to include the scripts in the footer and should be used instead of the above methods.

With built in WordPress function you can easily control script dependencies and make sure that nothing is included twice …

]]>
By: David Walsh David Walsh http://davidwalsh.name http://davidwalsh.name/?p=5610#comment-39481 2012-11-16T16:46:13Z 2012-11-16T16:46:13Z For plugins sure, but it’s not as important for theme scripts. Additionally, these techniques could be used for META tags too.

]]>
By: chrismccoy chrismccoy http://davidwalsh.name/?p=5610#comment-39452 2012-11-16T10:07:07Z 2012-11-16T10:07:07Z you should really avoid doing it that way, echoing tags, you should use wp_enqueue_script and wp_enqueue_style instead

]]>