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!

 

5 Responses to “Why I Love Feedback, or Templates and Hierarchy, Continued”

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

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

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

  4. Aliza Says:

    (Feel free to tell me the reason I’m not following this is that I’m a hopeless technomoron. I can take it.)

  5. Hadass Eviatar Says:

    Stop calling yourself names!! There is no such thing as a technomoron, just bad explanations and a predisposition to glaze over before you give yourself a chance to understand.

Leave a Reply

CommentLuv badge