How to include jquery ui in wordpress

When you enqueue your script, it enqueues for the whole site including admin panel. Using wordpress hook you can include jquery ui in wordpress website. If you don’t want the script in the admin panel, you can only include them for the site in frontend.

How to include jquery ui in wordpress

This following code you need to add in functions.php file.

function my_add_frontend_scripts() {
    if( ! is_admin() ) {
        wp_enqueue_script('jquery');
        wp_enqueue_script('jquery-ui-core');
    }
}
add_action('init', 'my_add_frontend_scripts');
How to include jquery ui in wordpress

How to include jquery ui in wordpress

Then you are able to see the jquery-ui in your wordpress theme.

Add a Comment

Your email address will not be published. Required fields are marked *