O'Reilly logo

WordPress® Bible by Aaron Brazell

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 10. Understanding the Template File Hierarchy

IN THIS CHAPTER

  • Looking at the minimum necessary template files

  • Understanding the common template files

  • Enhancing the user experience with template files

  • Developing custom template files

WordPress provides a robust theme system. With its system of files and file hierarchy, it is possible to create very complex or very simplistic themes that render different content in different ways.

The first order of business, before describing the template file hierarchy, is to determine the different types of content WordPress can handle out of the box. As noted in the database schema for the posts table (see Table 7.1 in Chapter 7), WordPress comes with four different content types: posts, pages, attachments, and revision. Each of these data types can have a unique template.

Note

See Chapter 7 for more information about the WordPress database schema and interacting with the database.

With this data classified, it is also possible to recognize a few key groupings of content. These groupings can best be thought of as ways to organize content. Archives are the most common, but archives can be broken down further into category archives, tag archives, and date-based archives. And then each of these groupings can have individual templates.

Of course, there are basic template files as well. Every theme needs a stylesheet, for example, while most themes include a template file for the structural elements of a page such as the header, footer, and sidebar. ...

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