Using JavaScript in themes the right way


show more Using JavaScript in themes the right way provides you with in-depth training on Developer. Taught by Chris Coyier as part of the WordPress 3: Creating and Editing Custom Themes show less
please wait ...

Using JavaScript in themes the right way

I would like to talk a little bit about using JavaScript within a WordPress theme. So when you use JavaScript, you link out to JavaScript files from somewhere within your website. I have our whole theme folder opened up as a project here in TextMate. In the header.php file, we could link out the scripts right from within here. I could do something like this. Script src = js/test.js, close that script tag, and there we go.

We have some JavaScript that's going to be loaded and activated on this page. You might see it in the head section. You might often see it in the footer. It's often recommended that for speed purposes scripts can be loaded just before the closing body tag down here so they don't interfere with the loading of the page. That's pretty common. So that's one way. It's absolutely going to work in your WordPress theme. There is no reason why you can't do it that way. But there is an important concept here, and if you are working with JavaScript these day...

Using JavaScript in themes the right way
Video duration: 8m 35s 4h 28m Intermediate

Viewers:

Using JavaScript in themes the right way provides you with in-depth training on Developer. Taught by Chris Coyier as part of the WordPress 3: Creating and Editing Custom Themes

Subjects:
Developer Web
Software:
WordPress
Author:
please wait ...