When you venture through Presentation to Theme Editor and then open up Sidebar in your WordPress Dashboard, the code can be a little intimidating at first. Panic not, that is only because there are lots of conditional statements so that different things display on different pages.

Let’s start at the top and work down:
<div id="sidebar"> <ul> <li> <?php include (TEMPLATEPATH . '/searchform.php'); ?> </li> <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it. <li><h2>Author</h2> <p>A little something about you, the author. Nothing lengthy, just an overview.</p> </li> -->
You will find searchform.php in the list down the right of your edit screen and it will need editing separately if you want to change its appearance. Although in the default (Kubrick) theme the author information is disabled, it is actually something blog surfers expect to see, so let’s enable that section and move it to the top.
<div id="sidebar">
<ul>
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<li><h2>Author</h2>
<p>A little something about you, the author. Nothing lengthy, just an overview.</p>
</li>
<?php } ?>
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
But we don’t want that short bio showing on every page, so as well as removing the comment to enable it and cut/pasting that block higher up, it has been surrounded by if ( is_home()). WordPress has the ability to know which page is being delivered and showing or hiding blocks accordingly. If you think about that ability, it presents options such as being able to display your copyright notice and credits on your main page, but an alternate footer on other pages.
<li>
<?php /* If this is a 404 page */ if (is_404()) { ?>
<?php /* If this is a category archive */ } elseif (is_category()) { ?>
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
<?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<p>You are currently browsing the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives.</p>
<?php } ?>
</li>
In the next block shown above are conditionals with a vengeance, mainly worth looking over to understand how to build conditionals with more than a yes/no option. But note too that you could highlight this whole block up and either delete it, move it from the sidebar into the main body of your pages, or – for a 3-column design – move it into your second sidebar. In short, the functions in it are not location dependent. Providing you ensure you move the whole block, most blocks will function perfectly well in any template.
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
<li><h2>Archives</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
</li>
<li><h2>Categories</h2>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
</ul>
</li>
The section of code for displaying links to your blog’s pages, archives and categories (remember these can be deleted or swapped around as you choose) hints at the way parameters can be used with wp_list_pages, wp_get_archives and wp_list_cats (and also with get_links_list in the next section). Each one gets a full page in the WordPress Codex, so rather than turn this into War and Peace, I have linked to those pages. It is worth checking them out because you can narrow what is shown, the order of the display and many other parameters.
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<?php get_links_list(); ?>
<li><h2>Meta</h2>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
<?php wp_meta(); ?>
</ul>
</li>
<?php } ?>
</ul>
</div>
The final section is wrapped in another conditional (which you may remove or change) such that your links list(s) and “meta” links will only appear on the front page. It is quite possible you may want to remove some or all of these meta links (although if you do, be nice to WordPress and move their credit somewhere else) or add others. I do recommend that even if you don’t keep the validator link up once your site is live, you keep it during testing, so that you can check all your pages. And to that end, I would (temporarily) comment out the conditional.
Once you have your layout as you want it, cosmetic changes are made via the theme’s Stylesheet. In the default theme note that there are no special classes anywhere in the sidebar: all the styling is controlled by the single div id=”sidebar” at the top of the code. So when you turn to the Stylesheet, you will be looking for entries such as #sidebar h2 and #sidebar ul, #sidebar ul ol plus whole blocks like /* Begin Sidebar */. If your editor can search on #sidebar that is one of the surest ways of locating all the relevant entries.
Always remember to keep a clean copy of your theme’s files so that you can back up and check each change as you go along, rather than making lots of changes at once. If you bear those thoughts in mind, I strongly recommend you move things around and play with the styles, just so you can see the effect of each change and get used to how it all works.