These days I recommend using the Genesis Framework for WordPress and in the sites I build I incorporate the new Bootstrap v4 grid system into that.
OK, so hopefully you’re still with me after Part 1 of this tutorial. Let’s get on with the footer
5. Convert the footer into WordPress widgets
At the moment the footer region of the front.php template looks like this. Note that we’ve also copied in the closing </body> and </html> tags that were opened in the now separate header.php file.
So, there’s some basic HTML that divides the footer into 4 columns, with a another 2 column footer underneath, then it loads all the javascript files, then there’s some lines of jquery that are binding the jquery functions from those separate js files to particular HTML elements on our page. Just looking at them here I can tell that WordPress wouldn’t like them as they are because they’re not explicitly defined as jQuery ones, they’re just using the $ variable (see this tutorial for more on WordPress and jQuery). We’re going to strip out all of the Javascript for now anyway, as that will be handled by our functions.php file later on.
We could just leave the 4 columns in the footer as they are, but it’s much more user friendly to control their content from inside WordPress, and using its widgets seems the best way to go. I don’t want that other 2 column footer beneath the 4 column one so I’m going to remove its code from my template.
The markup for our template is pretty easy as we’ll just be swapping each footer column for an empty WordPress Footer widget numbered 1 – 4. Plus we’ll add the very important wp_footer(); line as well as that’s what will be replaced with all our js files when WordPress creates each page.
Note – although this Flashmint template is using the HTML5 doc type, it isn’t using any HTML5 markup elements. It’s still using the old HTML of <div id=”footer”> for example, when it could/should be using <footer id=”footer”>. I could change this now, but it might mess up some of the CSS. Plus we’d also need to attach a script like modernizr that enables older browsers to interpret these new semantic HTML5 elements. That’s a separate issue though, and for simplicity we’ll just convert the template with its div based markup.
Here’s the new markup