Join Chris Converse for an in-depth discussion in this video Registering JavaScript files in WordPress, part of Creating a Photo Gallery in WordPress with jQuery.
…Now, we're going to hook in some custom JavaScript files into our theme.…Now, since JavaScript files perform functions and can have file dependencies,…Meaning, some JavaScript files will only work if other JavaScript files…exist, meaning, if we use some JQuery, for example, we have…to include the JQuery script before we can write our own JQuery.…So we need to do what's called registering…our JavaScripts with WordPress, this way WordPress is…aware of all of the scripts that are running on a page and what scripts have…dependencies on other scripts.…Otherwise we could end up with duplicate scripts…or even conflicts between scripts and different namespaces.…
So to start this process, let's open up the…file inside of our theme called gallery functions include.PHP.…So inside of the My Gallery folder, we'll open this file up in our text editor.…Now all I have in place in this particular file is the…php, beginning statement, and the ending statement with a script goes here comment.…The actual registration code is in our snippets.…
Updated
11/24/2014Released
1/15/2014Skill Level Beginner
Duration
Views
Q: This course was updated on 11/24/2014. What changed?
A: We added one new movie about the dangers of modifying updateable themes.
Share this video
Embed this video
Video: Registering JavaScript files in WordPress