Home » PHP

WordPress: Sidebar not showing up on older themes with WordPress 2.9+

22 January 2010 No Comment

Revised 4/28/2010 with a new fix.

I noticed with the latest version of WordPress, an older template may not display the sidebar correctly. If you look at the source code, you notice a lot of HTML code is missing in the sidebar div. The easiest fix I found was to update the “sidebar.php” file in the template.

To get your old theme working, you will need to edit sidebar.php and have the following:

<div id="sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar') ) : ?>
  <?php endif; // end of sidebar1 ?>
</div>

This must exist somewhere within your sidebar.php. Older themes don’t have a sidebar div and thus would break. I usually place this code after the first “<div id=”content-right”>” section.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.