08Sep

Creating a Custom Theme

Written by Mark in Wordpress

There are many different WordPress themes in the WordPress theme directory over at wordpress.org.  However all to often themes can just be that little bit different to how you want them to be.  Therefore this post forms part of a series of posts on how to make your own WordPress theme.  Follow along to create your own theme if you like.  Today we are starting with the the anatomy of a WordPress theme.

Theme Directory

A WordPress theme is way of styling your website or blog to get it looking just how you want to look.  The great thing with themes is that you can change your theme without having the change or recreate the content of your site.  A theme is basically a collection of different files and images, along with some CSS in order to style it.  Lets take a look at the files that you will need in order to create a working theme.

  • header.php - this file contains the <head> tag of your site.  This includes the title of your pages and also information that links your themes stylesheet and RSS feeds.
  • index.php - this is the main homepage of your blog or website and contains the code that pulls your posts into your blog
  • single.php - this is the template file that is used to display a single post, often called the permalink poage, and includes the comments others have left and the comments form (these pull comments.php - see below)
  • sidebar.php - most blogs or websites contains some sort of side column with links to categories and/or pages etc.  This file provides this functionality
  • footer.php - a footer is a great way to show brief information about your the site author and any terms and conditions or copyright information etc.
  • comments.php - this is the file that is used when you are adding comments to your blog, so it list comments that are already made and also contains the comment form
  • page.php - this page is similar to index.php but allows you to have pages (rather than post) looking slightly different as all pages on your site use this template if it is included in your theme.
  • style.css - this is the stylesheet for the them that contains all the style information as well as the theme name and author etc.

So that is basically the anatomy of a WordPress theme.  In the next post in this series we will concentrate on the style.css file and getting that ready with your basic information.

Tags:

One Response to “Creating a Custom Theme”

Trackbacks

Share Your Thoughts

* fields are required