Fix WordPress Sidebar Widgets That Don’t Work
You may have come across a cool WordPress theme that you really want to use on your WordPress blog but it might need just a bit of tweaking to make it standout or, in some cases work correctly. In this example what to do if your new themes widgets aren’t working.
This post is taken from the “Ask Max” page where I try to answer your questions about WordPress. First off I ask those posting questions on that page to not get too technical or into things such as template coding and things of that nature. And in this case the question actually wasn’t of that nature but the answer is.
Here is the Question:
When I try to customize the sidebars, nothing changes! No matter how I drag and drop widgets on them, they always look the same with same default categories & archives on the left and calendar blogroll, and meta on the left. Any idea why that is? Thanks.
After looking at the theme, jd-nebula-3c 1.0, and dealing with the arrogance on a certain forum that is supposed to help people with their WordPress blog, I figured out what the problem with theme is.
The WordPress widgets are not working on this theme meaning that moving them around in the dashboard didn’t register a change on the blog itself. The first issue with this two sidebar theme was the functions.php file. so lets fix that first and without going into an in-depth explanation I am just going to show you the proper code to use in your functions.php file.
Warning! Before you change any code in your themes template files create a backup so you can restore it if it doesn’t work for you!
Below is the code needed in the functions.php file to use for a two sidebar theme. It basically says to get sidebar1 and sidebar2 if they exist. Replace the all the code in your functions.php file with this:
<?php
if ( function_exists(’register_sidebar’) )
register_sidebar(array(’name’=>’sidebar1′,
‘before_widget’ => ‘<div id=”%1$s” class=”side-c %2$s”>’, // Removes <li>
‘after_widget’ => ‘</div>’, // Removes </li>
‘before_title’ => ‘<h3>’, // Replaces <h2>
‘after_title’ => ‘</h3>’, // Replaces </h2>
));
register_sidebar(array(’name’=>’sidebar2′,
‘before_widget’ => ‘<div id=”%1$s” class=”side-c %2$s”>’, // Removes <li>
‘after_widget’ => ‘</div>’, // Removes </li>
‘before_title’ => ‘<h3>’, // Replaces <h2>
‘after_title’ => ‘</h3>’, // Replaces </h2>
));?>
Next the sidebar file in this particular theme was calling up two sidebars that the functions.php file didn’t know about. We just fixed the functions.php file above and now we need to add the proper code in the sidebar.php file. Open your sidebar.php file and look for these two areas of text, the red text is the problem that needs addressed:
This is for the left sidebar:
<div id=”left-sidebar”>
<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar(’Sidebar_1′) ) : else : ?>
<div id=”categories”>
And a little further down is the right sidebar:
<div id=”right-sidebar”>
<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar(’Sidebar_2′) ) : else : ?>
You can see that these are calling for Sidebar_1 and Sidebar_2 but again the functions.php file had no reference to them. So now replace the red text in your sidebar.php file with this code:
For the left sidebar use this:
<div id=”left-sidebar”>
<?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar(’sidebar1′) ) : ?>And for the right sidebar use this:
<div id=”right-sidebar”>
<?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar(’sidebar2′) ) : ?>
This is the fix for WordPress sidebar widgets that don’t work on the particular theme mentioned above. It may work on other broken WordPress themes but I offer no guarantees.
If you need help customizing or fixing your WordPress blog post a comment or click here to send me an email, you will find my fees are very reasonable.
Customize WordPress WordPressIf you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Tagged with Customize WordPress, WordPress
Related Posts




















