Customizing WordPress #6 – Introduction to the functions template
LevelUpTuts
The 6th video in the Customizing WordPress tutorial series. Here we explain the basics of the WordPress functions.php template
0:20 The functions file is where you add a lot of custom functionality to your theme.
0:40 You can put your custom function in your theme or in a plugin. If the function is theme specific then it goes best in the theme. If you’re going to use it a lot of different places it goes best in a plugin.
1:15 What can you do with a custom function. Well, you can enque scripts with it so you can add javascript or css to your site. We do that in this video to give you a basic idea. You can register new widget areas. You can create new image styles that you can then use within your site like predefined image sizes. You can create custom post types.
1:40 The functions.php file is a very powerful file that we’re going to be spending a lot of time in.
1:55 What’s important to know about this functions file is that it is going to get run when wordpress is loading. Anything that you are doing multiple times at your site can actually be put into a function in this file. And then you can always just call this function because this function is always going to be loaded.
All of the above may be unclear but it will become clear as we go through the material.
2:30 So first we need to create a functions.php in our twentyfourteen child theme.
3:00 So in our new file the first thing we need to do is to create the file.
3:20 Now we’re going to go back to our twentyfourteen theme folder where we see that there are tons of files. By examining these files we can learn a lot.
So we’re going to look into the parent twentyfourteen folder’s functions.php above to learn about it (below)
3:27 And we notice there is a huge comment running from line 2 to line 26.
3:38 And we have functions that are being added and adding functionality to our site. We have our widget areas that are being added.
4:00 So as we scroll down we see that basically there are a lot of functions that are being run here. And these are all doing different things to extend the functionality of our site.
It is worth going through the file and reading all of the comments even if you don’t understand them all.
Here is a link to The Complete WordPress Twentyfourteen functions.php File For Review.
4:20 So now we’re going to back to the Twentyfourteen child theme folder’s functions.php.
And we’ll continue in future videos.