Posted by robhyland on 4th September 2009
n/a

Template Editing

The next step in setting up your CMS is editing the template. I usually start with the standard template, strip it down, and then rebuild with my design. Once I get the time I will make a stripped down WordPress template available on my site.

The Details

  1. FTP into your site and navigate to /wp-content/themes . Download, or at least copy to another folder, the default folder, which contains the default theme.
  2. Once you have a backup copy, hack up the top comments in style.css with some new info, so you know it is going to be your new template.
  3. Under the Appearance->Themes menu, select your new template. It should not look any different than it did before, since we have not actually changed any of the code yet.
  4. The next key file to edit is page.php. This is the page that is used by ‘Pages’ on your site.
  5. Looking through this file, you can see how WordPress works. It loads a header, the content, the sidebar, and a footer. Simple enough. You can move the pieces in this file around as you need to. If you need a page to be a little bit different than another page, you can copy page.php to a new file and add a comment to the top, just below the initial comments, to indicate that it is a page template:

    /* Template Name: Home Page */

    You can now use this new template for specific pages, in this case, the home page.

  6. Once you have familiarized yourself with page.php, the next important file is sidebar.php. I usually rip just about everything out of this file until it looks like

    <?php
    /**
    * @package WordPress
    * @subpackage Default_Theme
    */
    ?>

    <ul>
    <?php wp_list_pages('title_li=&exclude=') ?>
    </ul>

    If you want to learn more about listing pages, you can read about the wp_list_pages function here.

Comments are closed!