O'Reilly logo

Smashing WordPress: Beyond The Blog by Thord Daniel Hedengren

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. THE WORDPRESS THEME ESSENTIALS

If you want to do more advanced stuff with WordPress, you need to understand theme essentials. Naturally, you can just start hacking the default theme, or download Notes Blog Core and go from there, but there are things that won't be obvious from just using and tinkering with the code. That's why we'll take a dive into the WordPress theme concept in this chapter to get acquainted with themes and how they work. After doing that, you'll be able to put your knowledge to good use in the coming chapters. The following two chapters will discuss more advanced usage, and then you'll take it from there.

This chapter will get you started with themes in the sense that you'll see how they work and see how you can alter them to fit your needs. You've already played with the loop, now lets put it to good use and start building stuff.

Theme Basics

You're probably familiar with WordPress themes and the premises under which they operate. In short, themes are a way to separate the design from the code, but in reality there is still a lot of coding happening in the more advanced themes out there.

A theme consists of a folder with template files and any other files that may be needed. The only two absolutely necessary template files are style.css and index.php. The former contains the header that identifies your theme, while the latter is the basic layout. In fact, even if you don't put in the sidebar.php template file, or the comments.php comments template, you'll ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required