Footer Widgets don’t appear on the screen
-
I am trying to add sidebars into the footer and I’ve created the space and the sidebars but none of the content is appearing, what am I missing?
The page I need help with: [log in to see the link]
-
Did you add a call to dynamic_sidebar() in the footer.php template itself?
https://codex.wordpress.org/Function_Reference/dynamic_sidebar
This is the code I have inside the footer.php template
<div id=”footer-sidebar” class=”secondary”>
<div id=”footer-sidebar1″>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(2) ) : ?>
<?php endif; ?>
</div><div id=”footer-sidebar2″>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(3) ) : ?>
<?php endif; ?>
</div><div id=”footer-sidebar3″>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(4) ) : ?>
<?php endif; ?>
</div>What did you use as the name of the sidebar in register_sidebar? Use that string instead of a number.
and you don’t need all that wrapper code. Just
dynamic_sidebar( 'sidebar_name' );
I’m not exactly following. Here are the names of the sidebars
Footer Sidebar 1
Footer Sidebar 2
Footer Sidebar 3Please show your register_sidebar() code. Use pastebin.com or gist.github.com and paste a link to that here.
register_sidebar( array(
‘name’ => ‘Footer Sidebar 1’,
‘id’ => ‘footer-sidebar-1’,
‘description’ => ‘Appears in the footer area’,
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => ‘Footer Sidebar 2’,
‘id’ => ‘footer-sidebar-2’,
‘description’ => ‘Appears in the footer area’,
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => ‘Footer Sidebar 3’,
‘id’ => ‘footer-sidebar-3’,
‘description’ => ‘Appears in the footer area’,
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );So you’d use
dynamic_sidebar( 'footer-sidebar-1' );
If that doesn’t work, put in some debug code to see if that part of footer.php actually gets executed.
- This reply was modified 6 years, 2 months ago by Steven Stern (sterndata).
- The topic ‘Footer Widgets don’t appear on the screen’ is closed to new replies.