Creating your own WordPress theme starts with understanding the file structure of a theme. WordPress does not create each page from a single HTML page. It uses php files to put each page together. If you are creating a static HTML site and you want to change a link in the header you need to go to each page and make that change. With php, you can create one php file called
header.php and import that into all of you pages so that now, you can make only one change to
header.php and all the pages with that header will be affected. This is how WordPress Works. You make one change and all the pages that are affected by that change will be updated.
Your theme uses more than one of these php pages. There a number the files that WordPress uses to build you pages. Well go through the basics of the pages so you can understand where to start.
Let’s take a look at the most obvious pages first. After looking at a couple of the file names for these php files, you will start to get the idea. The php files are named in such a way that, most of the time, it is rather apparent what each pages does.
style.css– This include the styles for you page. This is the only truly necessary file that must be included in your theme.
header.php– This is the page header. This is what shows at the top of each page.
sidebar.php– This is the sidebar.
footer.php– This is the footer. This is what you want to show at the bottom of each page
index.php– This is the main page in you template. When someone navigateds to your bace url, this is what they will see.
single.php– This is a single blog post.
page.php– This is the page template. This is the mark up for pages, not posts.
comments.php– This is the comments template. It denotes how the comments on your posts will be marked up.
archive.php– This is the template used to show posts within a category, by an author, or in a date rage if those specific files are not provided.
category.php– This is the template for when viewing a category.
author.php– This is the template for viewing the posts by a certain author.
search.php– This is the template for viewing search results.
404.php– This is the page not found template. When the user enters a page within your wordpress install that does not exist, this is what they see.
functions.php– This is different than the other template files listed here. It included functions that help change the way wordpress works for your specific theme.
Those are the basics, but there are others and I would encourage you to check out the WordPress Codex on the WordPress website for more information about these file types. http://codex.wordpress.org
Each and every time you create a theme you will start with some configuration of the files listed above, and often you will need to have some of the same code in each page. It doesn’t make sense to start from scratch each time. Some great starter templates have been created and provided free to help you get started with your theme. Take a look at these themes and see if any of them can help you get started.
Bare-Bones Templates or Boilerplates
Roots is a starting WordPress theme made for developers that’s based on HTML5 Boilerplate, Blueprint CSS (or 960.gs) and Starkers that will help you rapidly create brochure sites and blogs.
You can use this however you want. Sell it, claim it, do what you want. Skimpy has basic WordPress 3.0 functionality enabled in its functions. This includes custom menus, post thumbnails, custom sidebars, and even a couple useful little tweaks that are commented out, but you can comment them in and do what you want with them. The only styles included are a container that sets the width of everything to 900px.
Bones was created after years of editing and reusing the same template to develop custom sites. It came from trial and error and tons of experience customizing templates.
Starkers is a bare bones WordPress theme created to act as a starting point for the theme designer…
Toolbox is a blank, HTML5, WordPress starter theme. Out of the box, it features: the latest in plain, old, semantic HTML5 markup and Ultra-minimal (it looks like there’s no CSS at all), fluid, em-based CSS that won’t get in your way when you’re starting a design.
Handcrafted WP is a starter theme built for WordPress developers who are doing more than building blogs. The theme is based on Ian Stewart’s Toolbox Starter theme and Paul Irish & Divya Manian’s HTML5 Boilerplate plus some other awesome features based off our years of experience. This is not a framework, but an almost-naked starter theme that gives you a rock solid starting point for crafting a serious website on the WordPress platform.
Whiteboard framework for WordPress was developed to speed up the process of developing a WordPress theme. Whiteboard does so by eliminating the time spent on code common to all WordPress themes and includes non-intrusive code that improves the overall WordPress theme in many ways – including SEO, speed, usability, and mobile support.
These are just a couple of the bare-bones themes out there for when you get started on your theme. There are many more and you should look around before choosing the one with the right features to help you create your perfect theme. Also, don’t think that these boilerplates are good to go out of the box. Edit them, play with them, and make them into what you need.