Add Scripts to WP Header.php with Functions.php

Sometimes we need to add references to scripts, metatags or conditional styles to the WordPress <head></head> section in header.php. WordPress has an action hook for this purpose. It’s very easy to use.

For example, IE9 struggles with CSS gradients so if you use ColorZilla to create a CSS gradient you will need to add a conditional style to wp_head() along with a gradient class (.gradient) to your elements with gradients. To add the style condition to wp_head, do this: