1

I am trying to load jquery-ui-core and jquery-ui-slider in the head of my theme. Here is my code:

function load_jquery_ui() {
    wp_enqueue_script( 'jquery-ui-slider' );
}

add_action( 'wp_enqueue_scripts', 'load_jquery_ui' );

The jQuery UI loads in the footer. But because I have some inline scripting (due to php implementation in the JS) I need it to load in the head. Anyone that has any idea how?

1

Actually. This answer is the only correct answer.

If you need jQuery for a certain script just add it as necessary in the jQuery array.

wp_register_script( 'ytc-admin-scripts', YTC_URL . 'admin/admin-functions.js', array( 'jquery','jquery-ui-slider' ), '1.0');

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.