Different pages, different sidebars in WordPress 1.5

David emailed me today to ask how I managed to have a different sidebar in my blog, as opposed to the other pages on the site. Sounds like a straightforward question, but with the new theme structure in WordPress 1.5, it isn’t as straightforward as you might first imagine.

First off you need to know that you can create Pages in WordPress – so, for instance, the Services page, the Home page and the Contact Me page on this site, were all created in WordPress.

Knowing that, the next thing to realise is that pages created in WordPress can be associated with individual templates.

How does this all help me? Well, what I did was to create template files, based on the home.php file which ships with Kubrick (Kubrick is the default theme which ships with WordPress 1.5 and currently the theme deployed on this site), and I associated the pages I created with their template files.

Then I edited the template files, removing the call for the sidebar ( ?php get_sidebar(); ?), I copied the code from sidebar.php into the template files, where the call to sidebar was, and I edited the code to only display the links I wanted.

4 thoughts on “Different pages, different sidebars in WordPress 1.5”

  1. Pingback: davids brain blog

Comments are closed.