Print Friendly

Featured Image


Show Extras

The remaining theme files are setup similar to the index file created earlier. A call to the header, the unique page content, then a call to the sidebar and footer. Setting up these files will basically complete the functionality of your WordPress site. Of course there is a lot more advanced features of WordPress but here are the basic files you’ll need to run a simple blog. Just like with the previous posts, when editing these files replace all instances of MyTheme with the name of your theme.


The 404.php file is the page that displays when a link is broken or a page cannot be found. One thing to note in this file is that it is the error page I will be using for the whole site. So if someone is viewing an album in the Zenphoto CMS and an error occurs this page will be displayed. So before I can call the WordPress header I have to make a connection to the WordPress tables. That is why you will notice the first line of this file is unlike the rest in that it doesn’t immediately call the WordPress header. You can change the sentence beginning with “Apologies” to the message you want displayed when your visitors view the 404 page.


The archive.php file is used to show a list of files that fall within a certain date range. For instance if you click on a month in the Archive widget in my sidebar, the archive.php file will be called to display posts within that date range. For more information about it check out’s explanation.


The author.php file is a template used to display information and posts by a specific author. This is mainly useful for WordPress sites that have more than one author. I am including it because it’s nice to have it in place in case I decide to add an additional author to my site. Here is’s information on it.


The category.php file is the template used to display all posts within a certain topic. If you read a post and it says “Posted in:…” that is the category the post is under. If you click that category it provokes the category.php file and displays all posts in that category. has a good and thorough explanation here.


The comments.php file is used to handle all the comments and the comment submission. The file was too long to paste in a code box so use the comments text file. also has some information on it here.


The page.php template is used for each page that you create in WordPress. It is pretty straight forward. If you want to know more check out’s description.


The single.php file is used to display a single post. When you click on a post title and it displays the whole post and only that post, it provokes the single.php file.


The tag.php file is almost identical to the category.php file. Instead of showing posts by category it shows posts by tags.

Search Form

The searchform.php is the form for the input field and submit button of the search function in WordPress. This is just the layout of the form, while all the asthetics of it are are done in the CSS file.


The search.php is the page that displays the search results.


I hope this has helped explain the rest of the WordPress theme files. I know my code is a mess because of the spacing and Word-wrap. I think it is a good learning experience for you to copy and paste the code and then have to go through and clean it up. This will help you read each line and understand what is happening. I know it takes more time to do it that way but at the end you will really have a more thorough understanding of the code. At this point in the tutorial you are basically done. Your site should be fully functional. The next two posts will just tie up any loose ends and the analytics.

Series Navigation<< WordPress Site Design – Zenphoto Integration

Post a Comment

Your email is never published nor shared. Required fields are marked *


Copyright © 2013 All rights reserved. | Site design by Daniel J. Eckes | Privacy