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.

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.
Related entries
Share your thoughts
