- Faruk Ateş
- Andy Clarke
- Kris Hadlock
- Robert Hoekman, Jr.
- Molly Holzschlag
- Sarah Horton
- Customizing WordPress: Make a Start
- Customizing WordPress: Using Plugins
- Customizing WordPress: Using Widgets
- Customizing WordPress: Pages and Posts
- Customizing WordPress: Integrating Other Apps
- Customizing WordPress: Edit Theme Style Sheets
- Customizing WordPress: Display a Better Title
- Customizing WordPress: Make a Lasting Impression
- Customizing WordPress: Dividing Long Posts
- Customizing WordPress: Starting Points and Tips for WordPress 2.5
- Customizing WordPress 2.5.1: Make the Most of Pages
- Customizing WordPress 2.5.1: Using the Links and Archives Pages
- Customizing WordPress 2.5.1: 404 Pages
- Customizing WordPress 2.5.1: Search
- Jonathan and Lisa Price
- Catherine Seda
- Dave Shea
- Dave Taylor
Table of Contents
- Web Basics
- Publishing on the Web: Putting Files on the Server
- Web Design Process and Workflow
- Project Management
- Mark My WWWord: HTML and XHTML
- Standards Compliance
- Meta Tags and Search
- Enhancing Web Page Interaction
- Web Graphics
- Web Page Optimization
- Overview of Servers
- Server Programming Basics
- Careers in Web Design
- Intellectual Property for Web Designers
Customizing WordPress 2.5.1: Make the Most of Pages
Last updated Oct 17, 2003.
Posts are the lifeblood of any blog, but the pages feature makes WordPress a very powerful content management system (CMS). In fact, you could set up a whole website using pages, with not a blog post in sight.
Pages are based on page templates. Leaving aside the special pages (Links and Archives) until my next article, the default theme ships with only one page template.
For this article, I'll use the fictitious example of a website with sections of information about large, medium, and small dogs. Each section has several pages based on its own distinct page template.
Set the Home Page
If you don't want your site to feature blog posts prominently, set a specific (static) page as the home page. Create a page (not a post) and publish it. Next, go to your blog's Dashboard and visit the reading settings. For the setting Front Page Displays, select the Static Page radio button, and choose an appropriate page from the pop-up menu (see Figure 1). Click the Save Changes button at the bottom of the page to make this change take effect.
Figure 1 For your site's home page, select one of the pages you've created.
Use Page Templates
When you write a page, it's based on a page template. The default theme ships with just one template, but if you create more, then you can choose an appropriate template for each page. For my fictitious dog breed website, I want distinct templates for large, medium, and small breeds of dogs.
Either edit an existing page or create a new one. Scroll down to the Advanced Options and click the disclosure triangle beside Page Template. Notice that the drop-down list shows all page templates available: the default template, Archives, and Links (see Figure 2).
Figure 2 The default theme includes three page templates. Other themes may have more or fewer.
The default template (page.php) produces a plain page similar to that for a single post. The Archives and Links templates are for highly specialized pages—a future article will explain them in more detail.
Figure 3 shows a page on my demo site. It uses the default page template. I've made sure that my sidebar includes a list of pages, but I've removed the list of posts.
Figure 3 This page is based on the default template.
Modify and Create Page Templates
The default template is a good one to use as the basis for your own templates, but you also need the special template header that's used in the Archives or Links template.
Make a copy of page.php and save it with a filename that's meaningful to you (for example, large-dog.php). Now open that new file in your text editor. Also open archives.php or links.php in your text editor and copy the template header, pasting it into your new file:
<?php /* Template Name: Large Dog */ ?>
Change the template name from Archives or Links to something that will make sense for anyone writing a page that will be based on this template. In my example, I changed it to Large Dog. This name is displayed in the page template drop-down list when you're writing or editing a page.
Now modify the rest of the page template to meet your needs. For example, you may choose to radically alter the content that's displayed, add fixed text or images that appear on every page using that template, or perhaps use styles to give each kind of page its own color scheme. Your changes can be as tiny or as far-reaching as you like.
In my template, I added a large heading, an image, a caption, and dummy page text. I also changed the text color. Figure 4 shows my Large Dog template, Figure 5 my Medium Dog template, and Figure 6 my Small Dog template.
Figure 4 The new Large Dog page template includes a header, an image of large dogs, and a caption. Body text is maroon. All pages based on this template will include those features.
Figure 5 The new Medium Dog page template includes a header, an image of a medium-sized dog, and a caption. Body text is green. All pages based on this template will include those features.
Figure 6 The new Small Dog page template includes a header, an image of a small dog, and a caption. Body text is blue. All pages based on this template will include those features.
With your new templates in place, you can choose the correct basis for any page on your site (see Figure 7).
Figure 7 When I create or edit a page I can now choose from several templates.
Customized page templates create a lot of possibilities for making a website that consists solely or mainly of pages rather than posts. WordPress is much more than just blogging software!