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 trialKen Chung
17,585 PointsDo professional WordPress developers use and add JavaScript to their websites?
I'm not talking about JavaScript components like carousels etc I'm talking about adding JavaScript frameworks like Jquery, Angular, Node.JS, and so on, is it a valid appoach? Is it practical in the real-world?
I understand you can add CSS frameworks like bootstrap, foundations etc into your websites, but what about JavaScript? Can you add JavaScript frameworks the same way you can add bootstrap? Thanks.
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsAdding JS is just as easy as adding CSS files and Boostrap.. In fact they use the same hook.
Take a look at this example or how to add scripts to your functions.php file
<?php
function wpt_scripts() {
wp_enqueue_script('file_handle', get_template_directory_uri() . 'js/scriptfile.js');
}
//Then add the hook
add_action('wp_enqueue_scripts', 'wpt_scripts');
?>