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 ...

Get Smashing WordPress: Beyond The Blog now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.