May
03
2014

May – Week 1

There are a couple of routes you can take when creating a WordPress site, you can either save yourself some time (and potentially, lots of effort) by using a premium WordPress theme (such as those found at Themeforest), or you can use a framework like bones (free), _underscores (free) or genesis (premium). Personally I like to use bones

(it comes pre-loaded with Sass, which I like), but shortened on time, I have purchased themes and I have mixed feelings about using them.

During late April I had a contact who wanted a website for a cake shop, I decided I didn’t want to worry about the writing the bulk of the CSS or PHP code, so I thought I’d experiment with a theme. Certainly it allowed me to finish the project quicker, in this case it was a reasonable decision, however, had the client had a very specific specification in mind, it may have been more viable to build something from scratch. (I’ll leave business and client interactions aside for the moment, but certainly it’s important to consider this when choosing whether or not to use a pre-built theme.)

The discussion here involves some of the points I’d agree with. Eventually you might even consider building your own premium theme for submission and retail on websites like Themeforest. Though we’ve got a lot to learn first, here’s a few things you should start learning how to do:

    • Learn about custom post types and how to use them in the WordPress loop. This is a simple and effective way to start looking into the working machinery of WP.

 

    • How to register new sidebars, menus and widgets. Very useful for adding further customisation to your site, or when you just want to stick a row of social icons in the nether regions of your site.

 

Using a pre-built theme means you won’t necessarily need to work with any of the above code, but you deny yourself some simple ways of creating a more individual site, where you are able to mold it to the shape you desire. One really important good practice that took me, stupidly, some time to start using was registering and using the “enqueue” function for my scripts/styles. I’ll explain, say you want to add a jQuery accordion for your site, you download the jQueryUI library and put the script.js file in your theme/js folder and the stylesheet in your themes/css folder. Typically you’d then stick these pieces of code in your theme’s header and footer.

Stylesheet link in the header:
<link rel="stylesheet" href="theme/css/jquery-ui.css" />
Script in the footer:
<script src="theme/scripts/jquery-ui.min.js"></script>

However doing this in WordPress can lead to problems, as it’s expected to load libraries from any plug-ins you may have downloaded. Loading scripts the traditional way can lead to various problems, I found a good explanation of how to do this here. If you’re still confused, open up a few different themes, and compare their functions.php files, I’ve often found I can usually figure out what I need to be doing by looking at things in this way.

(Also if your not using Sublime Text’s “find in folder” command, you really should be by now, it really helps when dealing with various pieces of functionality. Just right click the project root folder in ST’s folder view.)

TL;DR –
1. Create your a theme using bones(free) or _underscores. Try incorporating a custom sidebar, posts and jQueryUI script.

Leave a Reply