The following is in my function.php
file. I see the sidebar in my Appearance > Widgets
page but whenever I drag something on over the sidebar and save it just disappears once I leave the admin area.
I’ve scoured the web and the only solution I seem to find is that I need to disable ALL plugin to find the culprit… which I’ve done to no avail.
If I switch the theme to the WP 2012 theme then it seems to work, only my theme seems to break it.
add_action( 'widgets_init', 'ditto_register_sidebars' );
function ditto_register_sidebars() {
register_sidebar(array(
'name' => __( 'Right Hand Sidebar' ),
'id' => 'rightBar',
'description' => __( 'Widgets in this area will be shown on the right-hand side.' )
));
}
This is my sidebar-rightBar.php
file:
<?php
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('rightBar') ) :
endif; ?>
and how I include it in my theme:
<?php get_sidebar( 'rightBar' ); ?>
Just a quick note, I’m running on version 3.5.2.
I’ve tried to save in both Chrome and Firefox and my javascript console isn’t giving me any problems. I’ve also tried to do it in accessibility mode with no luck.
Any help is appreciated.
1 Answer
Its the camel-case in the widget ID. The following works:
add_action( 'widgets_init', 'ditto_register_sidebars' );
function ditto_register_sidebars() {
register_sidebar(array(
'name' => __( 'Right Hand Sidebar' ),
'id' => 'right-bar',
'description' => __( 'Widgets in this area will be shown on the right-hand side.' )
));
}
Per the Codex:
id – Sidebar id – Must be all in lowercase, with no spaces (default is
a numeric auto-incremented ID).http://codex.wordpress.org/Function_Reference/register_sidebar