The filename of the Sidebar template is sidebar.php. Typically, the sidebar is displayed on the right or left side of your WordPress template. In the default Twenty Ten theme, the sidebar is displayed on the right side of the template, by default (refer to Figure 12-3).
Similarly to the Header template, the Sidebar template is called into the Main Index template with this function:
This code calls the Sidebar template and all the information it contains into your blog page. Chapter 14 addresses some additional ways you can call in the Sidebar template, including having multiple Sidebar templates and using an include statement to pull them into the Main Index template.
In the "Using Tags with Parameters for Sidebars," section later in this chapter, you find information on template tags to use in the sidebar to display the usual sidebar elements, such as a list of the most recent posts or a list of categories.
The filename of the Footer template is footer.php. Usually, the footer sits at the bottom of the page (refer to Figure 12-3) and contains brief information about the site, such as copyright statements, credits to the theme designer or hosting company, or even a list of links to other pages within the site.
The default Twenty Ten theme shows the site title and a statement that says "Proudly powered by WordPress." You can use the footer to include all sorts of information about your site, however; you don't have to restrict it to small bits of information. In this chapter, I cover the typical footer that you see in the default Twenty Ten theme.
Similarly to the Header and Sidebar templates, the Footer template gets called into the Main Index template through this bit of code:
This code calls the Footer and all the information it contains into your blog page.
Other templates are in the default Twenty Ten theme, and I don't cover them in depth in this chapter, but having at least a basic understanding of them is a good idea. The ones I list in this section give you that good, solid kick in the pants you need to get started with understanding WordPress templates. When you have that task licked, you can move on to learning the rest.
These other (optional) templates include
✓ Comments template (comments.php): Table 12-9, later in this chapter, lists some useful template tags for WordPress. The Comments template is required if you plan to host comments on your blog; it provides all the template tags you need to display those comments. The template tag used to call the comments into the template is <?php comments_ template(); ?>.
✓ Single Post template (single.php): When your visitors click the title or permalink of a post you've published to your blog, they're taken to that post's individual page. There, they can read the entire post, and if you have comments enabled, they see the comments form and can leave comments.
✓ Page template (page.php): You can use a Page template for static pages in your WordPress site.
✓ Search Results (search.php): You can use this template to create a custom display of search results on your blog. When someone uses the search feature to search your site for specific keywords, this template formats the return of those results.
✓ 404 template (4 04.php): Use this template to create a custom 404 page, which is the page visitors get when the browser can't find the page requested and returns that ugly 404 Page Cannot Be Found error.
The templates in the preceding list are optional. If these templates don't exist in your WordPress themes folder, nothing breaks. The Main Index template handles the display of these items (the single post page, the search results page, and so on). The only exception is the Comments template. If you want to display comments on your site, you must have that template included in your theme.
Was this article helpful?