A few months ago Chris Scott gave a presentation on ‘proper’ WordPress plugin development. It was full of great stuff so I thought I’d pass along a small slice of it here.
Instead of writing your CSS and JS to your theme’s header.php, or echo’ing it out in a function call; use WP’s wp_enqueue_style and wp_enqueue_script functions respectively. wp_enqueue_script is really handy to check for/load dependent scripts (jQuery, Scriptalicious, etc) and wp_enqueue_style even works on conditional CSS…
wp_enqueue_style( 'ie7-style', get_template_directory_uri() . '/ie7.css' ); global $wp_styles; $wp_styles->add_data( 'ie7-style', 'conditional', 'lte IE 7′ );
Chris’ article on condtional CSS is here:
and his full presentation is here: