Support » Themes and Templates » Added new widget area, cannot add widgets
Added new widget area, cannot add widgets
-
Hello, new to template building/tweaking. I’ve run into the following problem, can’t seem to find an answer out there.
I want to add a new widget area in my footer. This post was very helpful. I registered the widget areas in FUNCTIONS.php thusly:
if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Right Sidebar', 'id' => 'right_sidebar', 'before_widget' => '', 'after_widget' => '<br/><br/>', 'before_title' => '<h3>', 'after_title' => '</h3>' )); register_sidebar(array( 'name'=> 'Footer', 'id' => 'footer', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>' )); }
In footer.php, I’ve added
<div id="footer_widget"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer') ) : ?> <?php endif; ?> </div>
and i’ve changed the dynamic_sidebar parameter in sidebar.php to right_sidebar.
Both of these widget areas appear in the widget admin page. However Footer does not expand. I can’t drag new widgets to it, and the arrow next to it is unresponsive. Right Sidebar functions perfectly. Have I overlooked a step?
Thanks
-
Have you tried this in your footer.php?
<div id="footer_widget"> <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('footer') ) : else : ?><?php endif; ?> </div>
Try:
register_sidebar(array( 'name' => 'Footer', 'id' => 'footer', 'description' => 'Footer widget area.', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>' ));
<div id="footer-widget"> <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('footer')) : else : ?> <?php endif; ?> </div>
Interesting. After trying that code, in the widget admin, when I try to expand the Footer box in the right sidebar, a widget area is expanded down in the footer area, to which I can now drag widgets. It might have been there before, but I only noticed after adding the description. Presumably because its in footer.php…?
Anyway, many thanks!
Sounds more like a missing comma/bracket/semi colon somewhere in your functions.
snyles:
If your problem has been resolved, you may change the topic status become resolved.
🙂
- The topic ‘Added new widget area, cannot add widgets’ is closed to new replies.