Retrieve Lost Sidebar upon Widgets Activation

I played around with some widgets lately and once I activated a widget, then the whole sidebar disappear. This forced me to deactivate the widget and the sidebar will turn back to normal. Do you face the same? This is quite common in self-hosted WordPress due to variety of themes we used. This simple tweak might resolve it.

Most of the themes were designed based on WordPress 2.3 and below. It may or it may not support widget but most important is, the slight variance of php code used to call the loop is the main culprit.

Open your sidebar.php and locate the following code. You should find the code instantly since the file is pretty small. Depends on what theme you used, this is how it should look.

<?php
if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) :
else : ?>

The code is somehow outdated and doesn’t sufficient to call the loop. Replace the above codes with this:

<?php
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) :
else : ?>

This is how the final result should look.

widget_sidebar

Sample code used on the above image.

<h2>Blogs of Interest</h2>
<ul>
<?php get_links(-1, '<li>', '</li>', ' - '); ?>
</ul>
</li>
<?php
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) :
else : ?>
<li id="links">

Do you have other solution? Let me know how you resort yours.

digg reddit delicious stumbleupon technorati furl ma.gnolia
Does this post useful? Subscribe to RSS Feed for updates.
Posted on: July 3, 2008 | Under Tips & Tricks 
 

Share your thoughts




Speak your mind