Theme Structure & Templates
Before you read this, take a look into your WordPress theme directory and see what files it contains – notably, anything ending in .php
Over the years, the WordPress publishing system has developed a strong foundation for templates that allows designers to make themes that are as simple or as complex as needed. The simplest theme may only include a single index.php file, which is the absolute bare minimum. Every page on your site would then be displayed using that single default template.
The way WordPress works is that each time a page is requested, it will search for an appropriate template file for the type of content being displayed – if none is found, it will then continue to generalise the template it’s looking for until finally it just gives up and uses index.php
The key to customizing your wordpress theme then, is to understand the hierarchy through which WordPress will search. You can find the full hierarchy diagram on the WordPress codex site, but here’s a cut-down version I made earlier.
For example, when a user views the archives on your site for category X posts, WordPress will first try to use a template called category-x.php, which is specific to only X category. If it can’t find one, it will generalise to category.php, which is for any category archives view. Failing that, it moves on to an even more generalised archive.php (which might also used to display monthly archives, tag archives or author archives). Most themes will include at least an archive.php, but if not WordPress will just use index.php.
So how does this help us? Well, if you already have an archive template, but you wish to customize the way your “funny pictures” category is displayed for example, all you need to do is copy the archives.php to a new file called category-funny-pictures.php, and adjust accordingly.
In the next article, I’ll show you exactly how you can create a special page for your “family pictures” category that includes a thumbnail of the photo.
The truth is that WordPress is – hands-down – the easiest (free) content publishing system on the Internet. In less than 5 minutes you can have it installed, easily change the look and feel, and be loading content in. There is no other system currently available that gives you that much power with such a refined user interface and as wide-ranging open-source development community around it.
However, not all of us can run PHP files or have access to a database server, so in that case, your only option is to use a WYSIWYG application like Dreamweaver to produce HTML files, or hand-code them. Well, no longer. What this plugin allows you do is use an offline installation of WordPress, or one running on a development domain somewhere, then output the entire site to static HTML files for you to simply upload!
Why would you do this? Well, for one, you can host the site anywhere without a database – such as your Apple Mobile.me webspace. Secondly, you get a huge speed boost as the site no longer needs to access the database or parse the PHP scripts on the server side.
The only downside is that you will lose the interactivity of your blog, such as the built-in WordPress commenting system (which relies upon a database to update the page with new comments). The plugin author suggests using a third party comments provider such as Disqus to get around this though, but be prepared for a little theme editing.
For a long time, All-In-One was the reigning king of WordPress SEO plugins, but its day has come. SEO Ultimate is absolutely full to the brim, feature packed with lots of SEO-related modules – but the best part is that you can deactivate any modules you don’t need by using the simple control panel.
So besides the obvious meta keywords / title rewriting, what does this plugin offer?
- 404 monitor – essential if you’ve moved your blog, or are getting a lot of incorrect inbound links, this module will allow you to know exactly where and why the 404 errors are occurring so you can take the appropriate 301 action.
- Slug optimizer – which keeps your pretty URLs to a minimum by removing useless words like “a” and “the” from them.
- Competition researcher - a powerful tool for anyone hoping to get into a niche market, this module lets you investigate URLs or keywords to find how much competition there is.
- Automatic Deep-Linking – If you find yourself constantly linking certain keywords back to some of your best articles, let this tool do the linking for you. Just specify the keywords you want linked, the URL and like magic it will be applied site-wide.
- Link masking – if you’re running a successful affiliate program, but afraid of being penalised for it, then you’ll love this. With this module you can hide your affiliate links to look like http://yourdomain.com/out/url for example.
That’s all of the new WordPress plugins for now, folks. Stay tuned as next week I’ll take a look at some fabulous new themes for you to customize, and show you exactly how to put that elusive featured post thumbnail image into a custom category archives view. Comments, suggestions and feedback to the comments section below, please!