I’ve been spending a lot of time in the WordPress Codex trying to grasp a better understanding on how their templates work.

While looking through all of the files provided in the default theme, there were two that bugged me. archives.php and links.php. For the life of me, I could not figure out how they were used and how someone would get to a file that used those templates. I was about to just ignore them because I just figured they would never be used.

Well, by default, they aren’t used, but if you do use them, they can be pretty cool.

archives.php is basically an index to the entire blog. Sometimes the archives on your sidebar can get fairly long, which isn’t cool, so you have the option of putting the archive on it’s own page.

links.php is a page containing all of your links. It’s an unordered list of categories, with a child list of all of the links in that category.

Like I mentioned, these aren’t used by default. You have to “activate” them. Here’s how:

  1. Go to the “Write” section of the WordPress backend.
  2. Select “Write Page”.
  3. Give it the title you want (Something like “Archives” or “Links”). Leave the content area blank. If you put something in here, it won’t show up.
  4. In the options on the side, select the “Page Template” bar to reveal a dropdown menu.
    Page Template Dropdown
  5. Select the right template for the page you are creating.

That’s it. You’ll now have your special pages set up.

The cool thing is that you can create more of these special pages with different functionality like that. All you have to do is create a new php file in your themes folder and make sure something like this is at the top:

< ?php
/*
Template Name: My Special Template
*/
?>

You can put any HTML or PHP code you want, which is really cool!

Related Posts