Quick Intro
Welcome to my portfolio website. I specialise in developing simple but functional websites for my clients.
blog
Understanding WordPress Themes
If you are a newbie to WordPress and are wanting to customise the design and layout of your website, you will firstly have to understand how WordPress themes work. This is a very important part to learn as it will allow you to fully utilise the power that WordPress possesses.
Every WordPress website is controlled by a specific set of files that work together to generate the front end user interface, which is basically what you see when you load the website up in your browser. These files consist of a stylesheet and various template files that make up your website theme. In the most basic form a theme could consist of the following files:
header.php
index.php
single.php
page.php
archive.php
404.php
comments.php
search.php
footer.php
style.css
All these are standard theme files therefore WordPress will recognise these as templates and use them accordingly. WordPress retrieves these template files depending on the action the user has performed on the website. For example if the user does a search, the “search.php” template will be called, if they load the comments page, the “comments.php” template will be called and if they request an archive item, yes you guessed it, the “archive.php” will be called.
However, it is possible to add your own custom templates to the theme so that you are able to control individual pages of your website. Controlling individual pages is extremely important when using WordPress as a Content Management System, as you might want to use a different layout or call specific content to these pages. An example of custom template files could be a blog page or a news page. For my own website I have the following template files:
index.php
single.php (I have multiple single templates files setup)
page.php
archive.php
404.php
comments.php
search.php
blog.php (custom template)
portfolio.php (custom template)
category.php (custom template)
As you can see above I have created several customised template pages so that my content can be displayed on my website exactly how I want. To create a custom template for your website you will have to define this as a template by adding a specific PHP tag to the top of the file. See below for an example.
<?php
/* Template Name: portfolio */
?>
To define a new theme a specific comment must be placed at the top of the stylesheet. What these comments do, is give the theme a unique name, which enable WordPress to identify it as an actual theme. Below shows the comment used on the stylesheet within the default WordPress theme.
Theme Name: WordPress Default
Theme URI: http://wordpress.org/
Description: The default WordPress theme based on the famous <a href=”http://binarybonsai.com/kubrick/”>Kubrick</a>.
Version: 1.6
Author: Michael Heilemann
Author URI: http://binarybonsai.com/
Tags: blue, custom header, fixed width, two columns, widgets
*/
All your theme files are located in subdirectories residing in “wp-content/themes”.
I have tried to explain as clearly as think I can how WordPress themes work and I hope that someone finds this post useful. If you would like additional information or help on understanding WordPress themes please leave a comment and I will respond as soon as possible.
In my next “Tutorial” post I will discuss theme development further by showing how to begin creating your own custom WordPress Theme.