Why I Love Feedback, or Templates and Hierarchy, Continued

Queen of Hearts - (card, poker)On Feedback

I got some feedback from both ends of the spectrum – my physicist husband who was impatient of my soothing words and dangling participles, and my writer friends who glazed over at the mention of HTML. I was also delighted to hear that one reader has used my affiliate linkto buy the book! I cannot begin to tell you how valuable feedback is to me as I struggle to learn and teach simultaneously. People – don’t be shy of leaving comments. Constructive criticism is always welcome, and if I can help grow a community that discusses and shares around my posts, I will have achieved every blogger’s dream.

On Templates

Continuing with Chapter 3 of our book, the really important thing to remember about template files is that they show our visitors what we want them to see at every location on the site. Imagine that you have a deck of cards, and you scatter them throughout your house so that people in the living room see the Queen of Hearts, and those in the kitchen see the Jack of Clubs. The person’s location in the house determines what card they see. Similarly, the person’s location on your site determines what they see on their screen – which you have set using the appropriate template file. In the next section we will talk about how WordPress knows what to show at every location.

The Template Hierarchy

Template Hierarchy

The WordPress Template Hierarchy

This diagram (which you can click to see at full size on the WordPress.org site) shows us the philosophy behind WordPress’s template structure.  It’s less complicated than it looks.

Remember that when we installed WordPress on the local system, we had to set up a database. That database is really the heart of WordPress – it’s just a glorified filing system! When a visitor clicks on the link to a page, WordPress sends a query to the database to ask which page it should show on the screen. Notice the simple question in the box on the extreme left: what page? That is what a WordPress theme is mostly about. The rest, as Rabbi Hillel said, is commentary – go and learn.

What Pumpkin? (Sorry, my kids are Homestuck fans)

The first line of answers  consists of the specific template files that the theme could show you in response to a click – ranging from the classic 404 Not Found page through Search Results to the various kind of single pages, blog posts, archive pages etc.

  • There are special templates for archiving posts by author, by date or by category.
  • You can create a special front-page.php if you want to make your front page different from the rest of the site.
  • If you have multiple authors, you can create author.php template files to differentiate between them – adding their Gravatar profiles, for example.
  • If you are featuring different kind of products on different pages, you can create custom post types for each one.

That’s the end of Chapter 3 – if you are still with me, Chapter 4 takes us back to the WAMP installation to learn how to build our own basic theme. Stay tuned and remember that I LOVE comments, questions and constructive criticism!

 

Facebooktwitterlinkedinyoutubeinstagram

5 thoughts on “Why I Love Feedback, or Templates and Hierarchy, Continued

  1. Aliza says:

    Is the reason I’m not following a lot of this because I don’t use WP.org? My blog is on WP.com, which I understand is a lot less involved on the blogger’s part…

    • Hadass Eviatar says:

      I’m not sure but I think you can still edit themes on WordPress.com. In any case, understanding more than you did before can’t hurt even if you don’t actually use that knowledge at the moment.

  2. Kevin KS says:

    Reading your final paragraph here reminded me that I need to set up MAMP here in the office. Off to find a video tutorial!

    BTW: That Hillel quote has always been a favorite of mine!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.