If you have ever themed a WordPress site before you know about this file. It’s where you can set things up for the theme by adding features and functionality to the site. You can use it to call native PHP functions, WordPress hooks, or to define your own functions.
It’s a good first stop when making a new theme. Here we can start setting things up for the new site. It should be the first file you open when starting out. The file is pretty self explanatory and walks you through setting up your theme.
The good part is most of it is done for you. Thumbnails have been enabled, scripts and styles have been added and a main menu and widgets have been initialized. You should go through it and make changes as needed to match your theme. Below are the main things you may want to edit for your theme.
Media Sizes
By default ignition sets the post-thumbnail size to 300×300 pixels with the crop turned on. Feel free to change these numbers. It also comes with a header image size. You can change the numbers of these so it works well with your theme.
The header image size is meant to be used for large headers, and there are actually a few Ignition functions that rely on this size existing, so don’t just delete it. The headers in page and post content use this size by default. You can learn more about the media sizes here.
You can go and add your own sizes now, although try and find the common denominators between your image areas in your theme, so you don’t go making tons of image sizes. This will just bloat your server with tons of images and is not necessary. Images are responsive so find the largest size that is common between your images and use that size. This leads into the next topic:
Remove Media sizes
Most sites do not need the image sizes that come with WordPress on the backend. I have never had a clients touch these successfully, nor have I ever considered using them as they can be touched by the client and thus ruin the layout of the site.
Therefore I usually turn them off. You can do that by going to the WP admin and under settings>media set the medium and large sizes to 0. You can leave the thumbnail size at 150 or 300 because this one gets used in the back end in some areas and plugins.
It should be noted that this thumbnail has nothing to do with the post-thumbnail size, which we set up in our functions.php file. That size, thankfully, is not under our clients control.
Menus & Widgets
One menu comes with ignition and is output in the header of the site. You can add your own menus easily here. You can also scroll down further and change the widgets. By default there is one sidebar widget and 4 others for the footer area. If you remove widgets here make sure to remove them from the file footer-widgets.php too.
Google Fonts
Ignition makes it easy to use google fonts. Just search for $font_families in the functions.php file, or scroll down after the setup section and you will find it. Here you can add and change the google fonts being loaded onto the site. Just edit the $font_families array and your google fonts will be added.
All thats left is to add you fonts into the CSS. You can do this by going to assets>sass>core>variables. Here you can set the CSS variables for –font and –font-alt. You can also add your own.
Admin Access
Ignition automatically disables access to the back end of WordPress for anyone that is not an admin. The admin bar will also only show up for admins. If someone tries to access the back end but is not an admin, they will be redirected to the front page of the site. This behavior can be changed by editing the constant variable ‘IGN_WP_ADMIN_ACCESS_CAPABILITY’. This can be found in function.php. Feel free to change this or remove it completely.
Scripts & Styles
Styles and scripts have been loaded for you. You can easily add your own styles and scripts here, although you might not need to. If you’re adding CSS to the front end, just add a new sass file and import it into main.scss. And if your adding a new script for the front end, just add a new JS file to assets/js/custom folder and it will automatically get added to the site after npm compiles.
You will probably only need to add scripts and styles for libraries that you are adding or if you need to load something separately.
Preg_get_posts
This handy function can be used to change how default archive pages look. How many posts get loaded on the blog page or some other post type. You can manage all that here.
Other files
A few other files are added to functions.php mostly from the inc folder. You probably don’t have to touch these as they run in the background and set up some more stuff.