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 trialDiana Myers
2,955 PointsCorrectly 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
2,955 PointsThanks 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.
James Andrews
7,245 PointsYou want to use these functions.
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
http://codex.wordpress.org/Function_Reference/wp_enqueue_style
Examples of how to use them are on both pages.
shahardekel
20,306 PointsJames 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');