everytime I make a change to any widgets in admin they disappear – sometime just from admin, sometimes from the frontend and sometimes both.
I get them back by adding update_option( 'sidebars_widgets', $null );
to the bottom of functions.php – then I can see them in admin as ‘inactive widgets’. Then I manually re-add them all in admin – it’s very frustrating!
I’m using Canvas with a custom child theme. I added a new widget area by adding
// Underhome widget area
if ( function_exists('register_sidebar') ){
register_sidebar(array(
'name' => 'Underhome widget',
'id' => 'underhome_widget',
'description' => "A widget area underneath the home page content",
'before_widget' => '<div id="underhome">',
'after_widget' => '<div class="fix"></div></div>',
'before_title' => '<h3 class="title">',
'after_title' => '</h3>',
));
}
to functions.php
Then I created a page template and added
<!-- dislay the underhome widget -->
<?php if ( dynamic_sidebar('underhome_widget') ) : endif; ?>
I can’t see anything wrong with this? maybe it is unrelated?
Anyway I’m totally stuck does anyone has any suggestions apart from changing career?
It’s likely not anything you are doing wrong but, rather, a misbehaving plugin. There is a lot of ugly code out there that causes widget zones to freak out on the admin side.
Try killing all of your plugins first, do you still have the problem? If not, turn them back on a few at a time until you find the culprit.
If you have access to your PHP log, clear the log and refresh the page. Pull your log, get rid of all the PHP Strict Standards warnings that are everywhere since 3.6, and what’s left probably contains your error.