The ThemeShaper WordPress Theme Tutorial: 2nd Edition

Many of you have written or commented to tell us how much you liked Ian Stewart’s original tutorial, “How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial”. You’ll be happy to learn that that we’ve created a second edition.

The Theme Shaper WordPress Theme Tutorial: 2nd Edition


Many of you have written or commented to tell us how much you liked Ian Stewart’s original tutorial, “How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial”. You’ll be happy to learn that that we’ve created a second edition of the tutorial! Just like last time, you can expect one new lesson each day. What’s changed in the second edition? Keep reading to find out!

What’s new in the Second Edition:

  • Updated code samples that draw from the Underscores (_s) starter theme. February 2012 marked the release of the Underscores (_s) starter theme, and since then, it has gathered plenty of momentum. The code samples and file structure for the theme we’re going to create in this tutorial will draw from _s as a source of modern code that reflects current best practices.
  • New Lessons. Developing Your Theme Sense is worth reading if you’re completely new to WordPress Theme Development. It’ll teach you what you need to know to sharpen your theme intuition. Setting Up Your Theme Functions guides you through creating an organized theme structure, and Secure your WordPress Theme tells you what you need to know to lock your theme down from potential security threats. Distributing Your WordPress Theme covers the steps you’ll need to take to prepare your theme for distribution, and what you need to know about licensing.
  • New Tools. We added new awesome tools to the Theme Development Tools lesson.


In only 16 individual lessons, this WordPress Theme Tutorial is going to show you how to build a powerful, up-to-date, WordPress Theme from scratch. As we go along I’ll explain what’s happening including (for better or worse) my thinking on certain techniques and why I’m choosing one path over another. Essentially, I’ll be teaching you everything you need to know about WordPress Theme development.

At the end of this tutorial, you’ll be able to do almost anything you want.

The Theme Shaper WordPress Theme Tutorial: 2nd Edition

Skip to the Table of Contents.

Introducing the Underscores (_s) Starter Theme

If you haven’t heard of _s, in short, it’s a 100% GPL, community-driven starter theme that contains modern templates, starter CSS, and an organized file structure — everything you need to help you get your designs off the ground. You can also use _s as a starting point for your future theme projects. If you’d like to learn more about the thinking behind _s, please take a moment to read A 1000-Hour Head Start: Introducing the _s Theme. Come right back after you’ve read it. No, seriously, we’ll wait.

The simple theme we’re going to build in this tutorial, The Shape Theme (yes, it’s the  Shape Theme from the 1st Edition, updated for the 2nd Edition), is based on _s. Download it and check it out if you’d like to see the finished code we’ll be going through, live, in action. It’ll be a while before we get to the CSS lesson, but if you’d like to look ahead at the sample design we’ll eventually create for the Shape theme, you can grab it here.

A Word About Timeliness
Are you reading this on a date that makes October 2012 seem like a long time ago? Yes? Then there’s a good chance that some of the code samples in this tutorial are already outdated. That’s OK, because what’s more important is that you understand the broad concepts — the whys — that are presented in the lessons. You can always grab a copy of the latest _s source code from the GitHub repository.

Here’s the list of features your finished theme will be able to boast of:

  • A well-organized, modular file structure
  • All the search-engine optimization you’ll really need
  • Google-supported Microformat markup
  • Valid and logical semantic markup structure than can be used to create ANY layout
  • Smart default CSS layouts
  • Localization support: translation-ready mark-up and an RTL stylesheet
  • Dynamic body, post, and comment classes
  • Separated trackbacks and threaded comments
  • Two widget areas: the first one with default widgets, and the second coded to disappear when it’s empty
  • Support for the Aside Post Format (after the tutorial, you’ll easily be able to add support for more post formats)
  • A Custom Menu, Flexible Custom Header Image, and a Custom Background
  • Simple responsive styling, including a lightweight navigation menu for mobile devices
  • And all the typical WordPress stuff you expect from a theme

I think that’s kind of impressive—for any WordPress Theme.

WordPress Theme Tutorial Table of Contents

Ready for a WordPress Theme Tutorial that will show you how to create a powerful theme from scratch? Read it from the beginning and code yourself up something awesome. Note: if a lesson does not have an active link, it means that lesson hasn’t been published yet. 🙂

Check back every day for a new lesson.

  1. WordPress Theme Tutorial Introduction
  2. Developing Theme Sense
  3. Theme Development Tools
  4. Creating a Theme HTML Structure
  5. Template and Directory Structure
  6. Setting Up Your Theme Functions
  7. Secure Your WordPress Theme
  8. The Header Template
  9. The Index Template
  10. The Single Post, Post Attachment, & 404 Templates
  11. The Comments Template
  12. The Search Template & The Page Template
  13. The Archive Template
  14. The Sidebar Template & The Footer Template
  15. Reset-Rebuild Theme CSS & Define Your Layouts
  16. Custom Background & Custom Header
  17. Distributing Your WordPress Theme

Author: Michelle

Automattic Theme Wrangler. Dragon boat paddler. Runner. Kitty Mommy. Loves warm, sunny days.

77 thoughts on “The ThemeShaper WordPress Theme Tutorial: 2nd Edition”

  1. You folks are doing a great job contributing to the community.

    Please create and post a complete and comprehensive Creating Non-Blog, Business Website Using WordPress .Tutorial like this one, Theme Tutorial.

    Thank you guys you’re really helping out new comers to WordPress.


    Salman Ahmad a.k.a. Ronnie Depp

  2. Hey man, I just wanted to say thanks for all the theme help. It’s been invaluable. Great work, and great way to give to the community.

  3. Thank you for sharing your knowledge and insights. I’ve have been blogging for a while and was hoping to expand my knowledge and this is something that has taken my interest for quite some time now. Thank you again, for this comprehensive tutorial.

    1. Hi Hamad, unlike some themes, _s is not actually intended to be a parent theme that gets updated while a child theme remains untouched – you might be interested in this recent post about theme development with _s.

  4. Thanks for the tutorial!
    I’ve used this starter theme to put together a site for a client, and it’s worked well.
    The only issue I’m having is that when I try to install and activate a WordPress plugin, I can’t seem to get the scripts to load.
    Is there some special thing that I need to add in the functions.php file?
    Any advice would be greatly appreciated!

  5. I am just starting out in WordPress and google referred me to this tutorial after I searched for “the best wordpress creating a theme from scratch tutorial”. One thing I have learned about online tutorials is that you need to stick with those that are up to date like written/posted within the last 12 months or so. So when do you think you will post the updated Third Edition that covers the current version of WordPress 3.8? Thanks.

  6. What can i do with _S starter theme and what can’t i do?

    Cuz i want to start building wordpress themes, but is _S only for learning to make themes, and familiarize myself with wordpress or can i sell themes based upon _S?

    1. _s is intended as a starter theme – a base on which to build your own custom theme. It’s licensed under the GPL, and you can sell themes based on _s.

  7. So i just checked a few pages from _S, would i be right if i said that _s is like a [tiny] version of the normal files used in twentythirteen & twentyfourteen?

    Since i compared to twentyfourteen..

    1. Good question! I spoke to one of the developers involved with the development of all three themes, and he shed some light on this. Twenty Fourteen is based on a premium theme called Further, which was indeed based on _s. Twenty Thirteen was based on Twenty Twelve, which wasn’t based on _s, but over the course of its development, ended up being quite similar to _s. I hope this helps clarify the relationships between these themes!

  8. I really enjoyed learning from this tutorial, have everything running great with one exception.

    in my header I am getting ghost markup, after I am getting “&nbsp” and after “&nbsp&nbsp&nbsp&nbsp”

    Any idea why this would be getting injected. I have done nothing custom outside this tutorial.

    1. It’s hard to say without seeing an example, but my first thought is that extra &nbsp codes might be coming from a plugin. To test, you can temporarily disable all plugins and then check to see if the problem goes away. If you still need help after that, I would suggest posting more details and an example link in the help forums at

Comments are closed.