Wordpress 102

March 13, 2007

This is the second in a series of lessons about how to use Wordpress as a full-featured Content Management System. The first post, Wordpress 101, of this two-part lesson is located here. Wordpress 102 will continue on where that one left off and we will address:

  • How to utilize unique pages, with a unique layout
  • How to include “pages” in other areas of your template
  • How to make a portfolio with thumbnails and full size images
  • Customizing the Templates

In the last tutorial, we discussed how to set your home page as a unique page – and how to rename and link to your blog. Chances are good that if you are going to run an entire site through Wordpress, there will be more to it than just home and blog. What we need to look at now is how to create a “Page” and how to link to it in our navigation.

You’re going to need your favorite text editor again, we’re going to create a new template. Open page.php which should be located in (/wp-content/themes/YourTheme) add the following code at the top.

/*
Template Name: About
*/
?>

Save this page as about.php and upload it to your server.

Next, log into your Wordpress admin section and click on “write” then “write page”. Give it a title (let’s call this one “about us” and fill in some content). In the side bar you will see “Page Templates” click on this and select “About”. Now your “about us” page is using this new template – you can modify this template to your liking.

Now not to get too deep into template modification, but what if you wanted to put a little bit about yourself in the side bar of your about us page? Now you could certainly open about.php (that we just created) and insert your html code, save, and upload. That would work, but it kind of defeats the purpose of a CMS, which is to have all of your site’s content update able via the CMS and not by editing files.

A nifty little plugin called Improved Include Page will take care of this for us. First download the plugin and install it – there is great information on how to install this plugin (and how to use it for that matter) on the download page. So we won’t go into the specifics here.

Got it installed? Good, let’s keep going…

Yet again we are going to start with making a new page in the admin. Create a page, make the headline your name and in the body just type your contact information. Save your changes. For our purposes, we will need edit sidebar.php (the Wordpress Codex has great information on modifying sidebar.php), again this can be found in your theme (/wp-content/themes/YourTheme) directory. Now go to “Manage” and click on “Pages” – the first column has each page’s unique id. Copy (or write down if your old school) the ID of the page you just created (it will be in the column labeled ID). Also make note of the ID of your about us page. Got those two numbers? Good, let’s open sidebar.php in the text editor. At the bottom of the file just inside the tag place the following code.

if(is_page('8')) if(function_exists('iinclude_page')) iinclude_page(12,'displayTitle=true&titleBefore=

Leave a Reply

You must be logged in to post a comment.