I'm using the Bones theme, and I'm trying to turn jQuery plugins into WordPress plugins. In the init.php file for the 'Chosen' plugin I'm converting, I've included this code:
function chosen(){
wp_register_script("chosen-script",plugins_url( 'js/chosen.jquery.min.js' , __FILE__ ));
wp_enqueue_script("chosen-script");
wp_register_style("chosen-style",plugins_url( 'css/chosen.css' , __FILE__ ));
wp_enqueue_style("chosen-style");
}
add_shortcode('chosen', 'chosen');
Google PageSpeed came back with this error:
Put CSS in the document head (1):
Link node chosen.css should be moved to the document head in www.blank.com/
How can I include this CSS file in the header?
if (is_page('to-do_list'))
head
based on a shortcode, you will have to do something like this which is admittedly a bit processing heavy.