I’d suggest moving the script registering into the init action, and moving the enqueue(s) into a callback hooked onto wp_print_scripts
.
Eg.
add_action( 'init', 'register_those_scriptsNstyles' );
function register_those_scriptsNstyles() {
wp_register_script( .. your script params .. );
wp_register_style( .. your style params .. );
..etc..
}
add_action( 'wp_print_scripts', 'enqueue_those_scriptsNstyles' );
function enqueue_those_scriptsNstyles() {
if( !is_page( 'some-page' ) ) // If it's not the given page, stop here
return;
wp_enqueue_script( .. your script params .. );
wp_enqueue_style( .. your style params .. );
..etc..
}
NOTE: Despite the hook name, i’m pretty sure wp_print_scripts
should also be fine for enqueuing styles to. The important factor is to just ensure the hook you use occurs late enough for the conditional template tags to be set, ie. is_page
, is_category
and so on..
If not, try wp_head
instead.. eg. add_action( 'wp_head', 'your-callback' )
EDIT: For styles, just like the admin side, the public facing side has an action for styles to.. which is wp_print_styles
..(hook enqueues for styles to there).
Hope that helps..