0

How can you load a custom made Roller Theme for Jquery ui to wordpress?

I recently created and downloaded a new theme for the datepicker, but can't get it loaded.

I tried adding the css file to my theme files then doing an 'enqueue style' function, but seem to be missing something.

function my_add_styles() {
wp_enqueue_style('datepicker', get_template_directory_uri() . '/lib/js/datepicker.css');
}

1 Answer 1

1

The most important thing is to hook the functions, that register/enqueue your styles and scripts, at the right "time".

This would be on the admin_*/wp_*/login_enqueue_scripts-hooks.

Read about the instruction on WPDevel.

This answer provides even more details about the process of registering scripts & styles.

If you want to check if your script/style passed certain points inside WP_Dependencies, then simply use the following functions:

// is registered?
wp_script_is( $handle );
wp_style_is( $handle );
// is enqueued?
wp_script_is( $handle, 'queue' );
wp_style_is( $handle, 'queue' );
5
  • Oh, my mistake forgot the other line of code add_action('wp_enqueue_scripts', 'my_add_styles'); I tried admin_ and login_ too, but no dice
    – Kyle
    Aug 10, 2012 at 16:08
  • What's odd is I put the css file in the same place as Flexslider.css and enqueued the sheet in the same place in the functions.php file. Any ideas?
    – Kyle
    Aug 10, 2012 at 17:39
  • Do you mean run something like this - function is_enqueued_script( $script ) { return isset( $GLOBALS['wp_styles']->queue[ $script ] ); } print (int) is_enqueued_script( 'datepicker' ); ? That returned a 0
    – Kyle
    Aug 11, 2012 at 1:53
  • Okay, apparently everything being overridden by a plugin (sigh). Thanks for your help kaiser, much appreciated
    – Kyle
    Aug 11, 2012 at 2:08
  • See update (and please, clean up the comments - thanks).
    – kaiser
    Aug 11, 2012 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.