Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Upgrade 1.2 to 1.5

wp-alert.png
This article, written to accord with WordPress 1.5, is now obsolete. Please take caution when following its contents, as many things may have changed.

WordPress v1.5 has been available since April. If you are upgrading from a previous version, these simple steps will help you upgrade to the newer version in no time.

Reasons for Upgrading

There are many reasons for upgrading any software. Generally, they are the fact that the software has been improved and security issues have been addressed. Here are some specific reasons for WordPress users:

Improved Features 
The WordPress interface and functions have not only been improved, they've been expanded. There is a list of new WordPress Features, and in summary, the program is faster, cleaner, easier to use, and more powerful.
Template Driven Design 
WordPress uses templates to generate the pages dynamically. You can control the presentation of content by editing the templates using the Template Editor tool and the Template Tags.
Quick Design and Layout Changes 
There are hundreds of WordPress Themes to choose from and changing the look of your site is easier and faster than ever before.
Comment Spam Filters and Protection 
Comment spam filtering comes built in, catching most of the comment spammers before you see their posts in your comments.
Extensive Plugins 
There are hundreds of new and improved Plugins which will easily extend the functionality and power of your website. Creating plugins is easier than ever, too.

Before You Start

Before proceeding, backup your database, WordPress files, and your entire site.
  1. Begin by backing up your entire site and WordPress files and your database.
  2. Store your backups off-site, like on your hard drive.
  3. Disable all active plugins. In the Administration > Plugins panel, click Deactivate on each plugin. You can re-enable them after you're done upgrading.

Begin the Upgrade

  1. Download the new version of WordPress to your hard drive and unzip it to a new folder. (nb: version 1.5 can be found here in the archive).
  2. Delete the old WordPress files from your web host, except wp-config.php.
  3. Upload the new WordPress files.
  4. Replace your old index.php with the new index.php icluded in the download. (You can turn your old index into a theme following instructions below, so don't delete it entirely.) **Remember to adjust the path for wp-blog-header.php if your index page lives in a different directory than your wordpress installation.
  5. From your browser, type http://example.com/wp-admin/upgrade.php, using the file path to your WordPress wp-admin directory, to bring your database up to date.
  6. Immediately login to wp-admin. Select "options" then "Permalinks" from the menu. Click the "Update Permalink Structure" button, you shouldn't have to do anything else.

You should have a new WordPress 1.5 installation with the default template applied to your website. Don't worry, you can change this in a minute. First, reward yourself with a cold soda and some candy. If you want to adapt your old template to our new space-age system, continue on...

Check The New WordPress

Before you begin to fiddle with your new WordPress upgrade, take few minutes to test drive it. There have been some changes. For a simple test drive, the article First Steps With WordPress points out many of the new changes to the Administration Panels and the way your site works.

WordPress Presentation Panel
Begin by poking around the Administration Panels. You are now greeted with a Dashboard which lists your latest activity and news from around the WordPress Community. Keep exploring and you will find Write Page and Manage Page panels that handle the new WordPress Pages, allowing you to add content that is outside of The Loop like "Contact", "Sign up", "About", and "Resume".

On the Presentation panel, you will now see a list of Themes. There should be two. Click View Site and you will see the new look of your site. Click the back button and then select the other Theme. Click View Site again and you will see that the look of your site has completely changed.

Default Theme Single Post View
Change it back to the Default Theme, then click View Site and take a wander around your new site. Click the various links and see how the look and information changes the way it is displayed. With the Default Theme, there are two main looks. One for the non-single post pages like the front page, categories, archives, and searches, and other one for the single-post pages. The sidebar is gone. The new modular Themes allow you to customize the look of a variety of pages within your site.

When you are ready to really change the look of your site, or convert it to match your previous look, proceed on.

New Template System

A few things have changed in the way templates work in 1.5, most notably the addition of themes which make developing your site templates infinitely easier.

The first thing you will notice is the template files don't live in the root directory any more, they're in wp-content/themes so go there now.

You should see at least two folders there, default and classic. Each folder now holds a complete WordPress Theme. Classic is the old WordPress style converted into a theme. Default is an adaptation of Kubrick. Poking around these themes, especially "classic" if you were familiar with our old template, will be the best way to learn how themes work.

Upgrading Old Templates - Easy

To turn your old template into a theme :

  1. Create a directory for your Theme in wp-content/themes such as wp-content/themes/mytheme/, all lowercase and one word.
  2. Put your old index.php in the theme directory you just created
  3. Using a text editor, open it up to edit
  4. Delete the wp-blog-header.php line at the top that says not to delete :)
  5. Replace the following line: (or a similar CSS link)
     <?php echo get_settings('siteurl'); ?>/wp-layout.css 
    With this:
     <?php bloginfo('stylesheet_url'); ?> 
  6. Replace this:
     <?php include(ABSPATH 'wp-comments.php'); ?> 
    With this:
     <?php comments_template(); ?> 
  7. Copy your old stylesheet to your theme directory and name it style.css
  8. Open style.css and add the following header (copy and paste this and then customize it):
      /*
        Theme Name: My Hawt Blog
        Theme URI: http://example.com/
        Description: Best theme EVAR
        Version: 1.0
        Author: Me
        Author URI: http://example.com/
      */
    
  9. Go to the Presentation tab of the admin interface
  10. If you see your Theme on the list, activate it. If you don't review these instructions to make sure you did them all right.

Upgrading Old Templates - Advanced

Depending upon how customized your old WordPress site was, the process of modifying your old WordPress layout and design may be simple or complex. There are basically three methods: Working from your old site files, designing from scratch or redesigning an existing WordPress Theme.

We recommend the latter if you are not very experienced with CSS and HTML/XHTML. To design your Theme from scratch, you will find more indepth information on how to modify the layout elements in Themes and customize your Theme at Theme Development. If you are determined to use your old site files, here are the instructions.

To modify an existing Theme, follow these step-by-step instructions.

  1. Copy the following files from the Classic or Default WordPress Theme into a new folder:
    1. index.php
    2. wp-comments.php
    3. wp-comments-popup.php
    4. wp-layout.css
    5. searchform.php
  2. Open your index.php in your text editor.
  3. Comment out the wp-blog-header require line at the top of index.php. Do this by putting // at the start of each line.
    <?php 
    //* Don't remove this line. */
    //require('./wp-blog-header.php');
    ?>
    
  4. Update the stylesheet import line in index.php. Replace this:
    @import url( <?php echo get_settings('siteurl'); ?>/wp-layout.css );

    with this:

    @import url( <?php bloginfo('stylesheet_url'); ?> );
    
  5. If you use the Default Theme, you will have a line like this:
    <link rel="stylesheet" href="<?php echo get_settings('siteurl'); ?>/wp-layout.css" type="text/css" media="screen" />

    You must change that to this:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
  6. Update the wp-comments include line in index.php. Replace this:
    <?php include(ABSPATH . 'wp-comments.php'); ?>
    

    with this:

    <?php comments_template(); ?>
    
  7. Now save index.php
  8. Rename wp-comments.php to comments.php
  9. Open wp-comments-popup.php. Find this line at the top :
    require ('wp-blog-header.php');

    You must comment out that line like this:
    // require ('wp-blog-header.php');

    The top of your wp-comments-popup.php must look like this:

    <?php 
    /* Don't remove these lines. */
    $blog = 1;
    //require ('wp-blog-header.php');
    add_filter('comment_text', 'popuplinks');
  10. Save the file.
  11. Rename wp-comments-popup.php as comments-popup.php.
  12. Add a theme header to wp-layout.css that looks something like this (you can just copy and paste this for now):
    /*
    Theme Name: My Original Layout
    Theme URI: http://myblog.com/
    Description: Your theme
    Version: 1
    Author: You
    Author URI: http://myblog.com/
    */
  13. Now rename wp-layout.css to style.css.
  14. You should now have 4 or 5 files:
    1. index.php
    2. comments.php
    3. comments-popup.php
    4. style.css
    5. IF you use the Default Theme, you will have 5 files - searchform.php
  15. Now create a folder with the name of the theme (for example, carrots) and put the first four files there into that folder (and searchform.php if you use the Default Theme).
  16. FTP this carrots folder into the wp-content/themes/ folder. You should already have a classic folder and a default folder inside there.
  17. Set the active theme to this theme you have created by selecting it in the Presentation Panel.

Resources

This article is marked as in need of editing. You can help Codex by editing it.