How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial

Update: We’ve created a second edition of this popular tutorial! It contains updated code samples, coverage of the latest theme development techniques, and more. Check it out at The ThemeShaper WordPress Theme Tutorial: 2nd Edition.

In only 11 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.

Skip to the Table of Contents.

tutorial-graphic-large

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

  • All the search-engine optimization you’ll really need
  • Including google-supported Microformat markup
  • Valid and logical semantic markup structure than can be used to create ANY layout
  • Smart default CSS layouts
  • Dynamic Body, post and comment classes
  • Separated trackbacks and threaded comments
  • 2 widget areas coded to disappear when they’re empty
  • And all the typical WordPress stuff you expect from a theme

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

At the end of this tutorial, with code in hand, you’ll be able to do almost anything you want. You can even think of the finished Theme as your own personal website development framework for WordPress.

I’ve already used it to start another project of my own, The Shape Theme. Download it and check it out if you’d like to see some of the finished code we’ll be going through, live, in action. Alternately, you can browse through the up-to-date source code for the entire tutorial on Google Code.

WordPress Theme Tutorial Table of Contents

Ready for a WordPress Theme Tutorial that will show you how to create a powerful WordPress Theme from scratch? Read it from the beginning and code yourself up something awesome.

  1. WordPress Theme Tutorial Introduction
  2. Theme Development Tools
  3. Creating a Theme HTML Structure
  4. Template and Directory Structure
  5. The Header Template
  6. The Index Template
  7. The Single Post, Post Attachment, & 404 Templates
  8. The Comments Template
  9. The Search Template & The Page Template
  10. The Archive, Author, Category & Tags Template
  11. The Sidebar Template
  12. Reset-Rebuild Theme CSS & Define Your Layouts

312 thoughts on “How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial

    • For keeping track of the series I recommend just bookmarking this post. The table of contents will link out to each post in the series. And once the series is finished there’ll be a hyperlinked table of contents in each individual post.

  1. Still with default theme waiting for a great tutorial to make my own one.
    I think this moment is coming. Thanks for it.

  2. Any suggested ‘pre-requisite’ reading to cram in before we start? I’m pretty conversant with CSS and HTML, but the rest of it – PHP, WP loop, etc – is pretty much a complete mystery to me at the moment.

    • @Michael, There’s also a DVD I used to get me started with this programming stuff. It’s this one on Amazon if you care
      http://www.amazon.com/gp/product/B001EDRPOG/
      I thought it was good as far as teaching the technical aspects, although the aesthetic quality of the images they used was way below my expectations as a designer. But the technical stuff was definitely a super quick way to learn.
      Looking forward to your tutorial too Ian :) I love challenging programming tutorials, they get me excited :)

  3. Pingback: How To Create a WordPress Theme - PSD to HTML - PSD to Wordpress - PSD Conversion

  4. This is one WordPress Theme series that I’m looking forward to reading, implementing, and learning from! It’ll be great to finally have a theme that in theory I can call my OWN, and release it for others to use! :D

    Being only an 18 year old kid, I have played with WordPress for a couple of years now, and would love to give something back into the community. So this is an ideal opportunity for doing just that, I only hope some of my creative buds come out in force throughout these tutorials!

    Thanks
    Mark

  5. Pingback: Daily Digest for June 22nd | Digital Gilbert

    • No Photoshop and no grids. But that’s not to say that you can’t incorporate a grid when we get to looking at the CSS. It’s always good to design from rational principles.

      • blockquote cite=”"> It’s always good to design from rational principles.

        What is your position on grid based layout systems like 960.css?

  6. Pingback: How To Create a WordPress Theme | Free Wordpress Themes - CityScape

  7. I am looking forward to learning how to build my own theme. I like the magazine style themes the best. Hopefully with this tutorial, instead of using somebody else’s theme, I can build my own.

    Thanks, I am looking forward to learning!
    Jamie Croft

  8. Pingback: How To Create a WordPress Theme « Netcrema - creme de la social news via digg + delicious + stumpleupon + reddit

  9. I am sooooooooooo excited! I have always wanted to create with word press… and now!!! I can Wahoo! thank you for developing this!

  10. Unsurprisingly, brilliant.
    I’ve picked up so many bad habits along the way. This is going to help me unlearn them. Can’t wait to get started.

    • Me too, John. I’m going to stop back here once my book’s done and redesign Logo Design Love.

      Ian, thanks very much for putting this one together. I enjoyed working my way through the old wpdesigner tutorials, and I’m sure this will be the same.

  11. Pingback: How To Create a WordPress Theme | New WP Themes - WordPress News

  12. Sometimes things seem too perfect. It just so happens that yesterday on a whim I bought a wordpress hosting pack from godaddy, and my ultimate goal was to make a wordpress theme.

    So I can’t wait to get started, and thanks for the post!

  13. Hi Ian,

    This is a great idea, and I’m definately in for this one. Really been trying to grasp wordpress as a noob. and my current website shows that…. LOL

    Hopefully I can learn a good bit or two and at an ideal pace :)

  14. This is great. Thanks Ian. How hard will it be to add more widget areas? I really like all the widget areas in Thematic.

  15. Pingback: Resumen del día June 23rd | Widcket

  16. Pingback: links for 2009-06-23 « Mandarine

  17. Pingback: Enlaces en mi del.icio.us, junio 2009 | Vectoralia

  18. Pingback: WordPress Roundup: 25 June 2009 | WooCamp

  19. Pingback: Chris Dornan

  20. Pingback: Journaling Blog Articles

  21. Pingback: 如何创建 WordPress 主题 | 精品博客

  22. Pingback: Couteau Suisse N°38 la série des trouvailles

  23. Pingback: What I am currently absorbing | Hearsay | Jhames

  24. Pingback: links for 2009-06-27 | Boost Ventilator

  25. Pingback: Bloglayout selbst gemacht

  26. There are so many tutorials out in the wild that try to teach you wordpress theme development but your tut is by far outstanding.You have a clean crystal clear “training style” and i begin to understand. Thank you and keep up the good work!

    Kind regards,
    Oliver

  27. If I were being poetic, I’d say this is my long-awaited oasis in a parched desert of dessicated WordPress tutorials. ;D

    I’ve found many walkthroughs on building a WordPress theme from scratch, but most of them were written years ago—before threaded comments and child themes. And I need a little help right now with my personal site…

    I admire the work you’ve done on Thematic, so I’m extremely glad I found this. Thanks!

  28. Great Idea and Great start! I’m really excited for the rest of it. I like the way you’re approaching it, rather than just a huge post about all of it, you’ve divided it into lessons basically. Thanks Ian!

  29. Pingback: Wordpress Design and Theme Tutorials - Hidden Pixels

  30. Pingback: Learn How To Create A WordPress Theme | Blog Templates Reviews

  31. Pingback: How To Create a WordPress Theme « wp-popular.com

  32. Ian, this has just been so great. For me the actual CSS will be the icing on the cake. From all my experiences, I know you can not style every little thing but I am hoping the CSS will cover at least the major styling. For the short time I have know Ian Stewart, I sure he has a cool CSS already locked up somewhere.

    Have a great weekend.

    JIM

  33. Pingback: WordPress Weekend Resources - July 3, 2009 | Theme Lab

  34. Ian,
    In studying the functions file, the way you populated the widget areas with the arrays. Is this something new as I have never seen it but I love it. So much neater and easier then long coding the sidebar.php page.

  35. Pingback: Arbenting’s Weekly Inspiration and Best of the Web #11 | Arbenting

  36. Pingback: Cosas interesantes para ver y leer (8) | vloox

  37. Why do you use the word “Create” instead of “Make” ??

    I see that wpdesigner and other use the same word.. is it some kind of SEO optimization?

    • Because that’s the sort of term I imagine people would be searching with and—more importantly—because I think it sounds better.

  38. Hi there!
    I decided to tackle this (OY) and I am stuck.I really want to learn this and would very much appreciate your advice.
    In step 4 on : http://tinyurl.com/6zacb6 It says ” Visit your local site (localhost:port or localhost:port/wordpress), and enter the following information into the database setup form: ” and enter the following information into the database setup form…
    database name: wordpress
    database host/server: localhost
    database user: root
    database password: root

    I am not sure where/how you visit your local host (is that from the MAMP on your computer?) or is it in the phpMyadmin when you start up the MAMP to enter the information into the database setup form.. Where would this be found if it is on the setup phpmyadmin?
    Sorry I am a total supernoob.. :)
    Rebecca

  39. These links are broken: 11 # The Sidebar Template and 12 # Reset-Rebuild Theme CSS & Define Your Layouts.

    I get the message: site not found. Can you tell me the right link?

  40. Pingback: Reset & Rebuild CSS | listen to...

  41. Pingback: Wordpress theme készítés | Yloz féle zacc

  42. Pingback: Create Your Own WordPress Theme Tutorial

  43. Fantastic serie !!!
    I’m a beginner in blogging with wordpress and started a serie of posts about how I’m learning it.
    Your tutorial is exactly what I was looking for and I think it could be very helpfull to have a translation of it in french.
    If you agree with it I could do it for my blog with, of course, link to your posts, blog and promotion of Thematic.
    Let me know if you’re intersted with this idea.
    Thanks.

  44. Pingback: Blog… » links for 2009-07-08

  45. Pingback: links for 2009-07-08 | Digital Rehab

  46. Hi Ian,

    This series is what I need to get Archetype out of the beta stage. I believe my theme is going to be better after reading this. Thank you so much for sharing your knowledge.

  47. Pingback: Best of the Week 7/10 - Creattica Daily

  48. Pingback: Small Potato, How To Create a WordPress Theme, and New Redesign

  49. Pingback: tj mapes » Blog Archive » What I’m Reading (weekly)

  50. Pingback: How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial | Design Newz

  51. Pingback: My Favorite Design Links of the (Rest of the) Week | eGrace Creative

  52. Pingback: Créer un thème WordPress Traduction en français themeshaper | Eiffair

  53. Pingback: Créer un thème WordPress - Introduction | Eiffair

  54. Pingback: Créer un thème WordPress : Outils de développement | Eiffair

  55. Pingback: New Broom – a theme by Geoff Matheson

  56. Pingback: Créer un Thème Wordpress : 3. Structure HTML du Thème | Eiffair

  57. Pingback: WordPress Tips & Länkar v29-09 | wpxl

  58. Pingback: XAMPP中Apache不能运行的解决方法。 | 路人吧

  59. Pingback: Créer un Thème WordPress : 4. Structure des Dossiers et des Templates | Eiffair

  60. Pingback: 8 Tutorials about How to create a WordPress theme « WPCrowd

  61. Pingback: Learn How to Creat wordpress theme from A to Z. | guidesigner.net

  62. Pingback: 12 great tutorials on creating a new Wordpress Theme | [Re]Encoded.com

  63. Pingback: Créer un Thème WordPress : 5. Le Template Header | Eiffair

  64. Pingback: Créer un Thème WordPress : 6. Le Template Index | Eiffair

  65. Pingback: Créer un Thème WordPress : 7. Les Templates Single Post, Attachment et 404 | Eiffair

  66. Pingback: Créer un thème WordPress : 8. Le Template Comments | Eiffair

  67. Pingback: 8 Tutorials about How to create a WordPress theme : FARIFUNCOM

  68. Pingback: How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial | WpMash - WordPress News

  69. Pingback: In choosing a CMS: 40+ Great CMS Theming Tutorials | Noupe

  70. Pingback: Créer un Thème WordPress : 9. Les Templates Search et Page | Eiffair

  71. Pingback: In choosing a CMS: 40+ Great CMS Theming Tutorials - Programming Blog

  72. Pingback: Amalgamis.com

  73. Pingback: How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial | wpden

    • I’d try resetting your widgets by uncommenting the 1 line in the tutorial code (it’s noted there).

  74. Pingback: WordPress Blog from Your Design Tutorials! | witola.com

  75. Pingback: Top 5 Content Management Systems « Lemuel Stevens – Freelance Web Designer & Developer

  76. Pingback: My First Theme

  77. Pingback: Créer un Thème WordPress : 11. Le Template Sidebar | Eiffair

  78. Pingback: Créer un Thème WordPress : 11. Le Template Sidebar | Eiffair

  79. Pingback: Créer un thème WordPress : 10. Les Templates Archive, Author, Category et Tag | Eiffair