Tag Archives: Wordpress Page Templates

WordPress Template Hierarchy

The WordPress Template Hierarchy is a critical part of truly understanding how your WordPress blog works.

Have you ever wondered why some WordPress themes have certain files while others do not?

A WordPress theme requires only two files as I have discussed before, the index.php and style.css. If you took a basic WordPress Theme and deleted all the files except those two in the theme folder, it would still work. However, the pages would basically look the same.

Now the question is, where do these other files come from? And how does WordPress know which ones to look for? This is actually a very simple process. WordPress uses a page hierarchy to choose which files to use for each type of page.

As an example if there is a single.php file, WordPress will use that for the individual (single) post, if that file does not exist, it will use the Index.php file.

There are 10 basic WordPress Theme pages, these are:

  • 404 (Not Found) page
  • Attachment page
  • Author page
  • Category page
  • Date page
  • Search Result page
  • Single Post page
  • Tag page
  • The Main (Index) page
  • WordPress Page

This gives us the ability to customize each type of page. This WordPress Codex page explains the Hierarchy.

Let’s look at the Tag.php page as a more specific example.

The Tag page hierarchy goes like this.

  • The Tag Template with a matching slug. If the tag’s slug were sometag, WordPress would look for tag-sometag.php
  • tag.php
  • archive.php
  • index.php

So if your WordPress theme does not have a Tag.php page you can easily copy the archive.php page to create a custom tag page, if you do not have a archive page, you could copy the index page to start your tag page.

To help you I have created a simple text file that lists the WordPress heirarchy that you can download here.

So with just a little thought and practice it is very easy to create very unique pages for your WordPress Theme.

WordPress Page Templates

Using WordPress page templates is a great way to create unique pages on your WordPress site. These are not blog posts, but custom pages. A WordPress page template is very easy to create and the WordPress Codex has a great tutorial to add pages to your site.

Using the page templates you can simply change your current page design or create completely new page designs. The possibilities are endless.

One of the key elements is that a WordPress page template allows you to keep the basic design and flow of the pages while adding custom content. This way when you change anything on your sidebars, header or footer the changes flow through to your pages. Unless of course you change any of those elements in the custom page.

Some examples on this site are the  Entrecard Dropped Cards page which displays the current list of people who have dropped their card for my review. PHP Books is a page that uses Amazon to display books about PHP Programming. Both these pages are dynamically created from RSS content using tools built into WordPress.

Custom pages are an excellent way to add content to your site. And while you are testing your new pages, just set the Page Status to Private so you can develop the page without anyone seeing it until you have it just the way you want it.

Entrecard Review

Entrecard is a fairly new free exchange network. As usual I was skeptical at first, but after doing a little research it looked like it would be worth a trial run.

I like to try things and most of the social networking / link exchanging systems have done nothing for me. I tried BlogRush and was highly disappointed. I am still running Scratchback, but it appears to be headed towards File 13 also.

I installed Entrecard yesterday and started researching their site. I have been very happy with the results in the last 24 hours. I have seen at least 50 visitors directly from the Entrecard system. My RSS and Newsletter subscribers have also increased, and I can tell at least on the Newsletter subscribers that these new members are directly related to being on Entrecard.

Darren Rowse did an Interview with Entrecard’s Graham Langdon and it is obvious that Graham is paying attention to what bloggers need and want. Hopefully he can make the necessary changes and updates to keep the majority of people happy. Graham also has a good sense of humor.

Based on some comments I have seen by Graham he is also acutely aware of the fact that you can not please all the people all the time, and you have to know where to draw the lines on making changes.

As usual, I had to do something a little different. As a way to thank those Entrecard members who stop by , in the left sidebar there is a link to Entrecard Dropped Cards, these are the last 10 dropped cards here on CyberCoder.net using a custom WordPress Page Template. I would also like to thank Mark Sierra @ meandmydrum.com for the information and opinions on EntreCard.

I plan on giving Entrecard a full 30 day evaluation and I will report again on the results.