Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Diana Myers
Diana Myers
2,955 Points

Correctly add jquery-ui to Wordpress theme

How do I correctly add jquery-ui.min.js, jquery_ui.css and the script snippet to a theme?

2 Answers

Diana Myers
Diana Myers
2,955 Points

Thanks for trying to be helpful, but I needed all the code elements - coding for jquery-ui.min.js, jquery_ui.css and the script snippet to add to the theme code. Fortunately, I found a plugin - jQuery UI Widgets.

shahardekel
shahardekel
20,306 Points

James is right. I just want to add a little more info: The 'wordpress way', is to use wp_enqueue_script, usually in your theme's functions.php file. You'll want to add a jquery dependency to it, as jquery UI depends on it.

It can looks something like this (inside functions.php): ``` function theme_scripts() { wp_enqueue_script( 'jquery-ui', get_stylesheet_directory_uri() . '/js/jquery-ui.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'theme_scripts');