Here is my code for a footer. Footer element should have div.footer-widgets, nav, and p elements as children. But for some reason wordpress puts everything to div.footer-widget element (I've included the screenshot).

This happens only after adding dynamic_sidebar. What is happening here?

<footer class="site-footer">

    <div class="footer-widgets">
    </div> <!-- End of footer-widget -->

    <nav class="site-nav">
            $arg = array(
                'theme_location' => 'footer',
                'menu_class' => 'navigation'
        <?php wp_nav_menu($args); ?>

    <p><?php bloginfo('name');?> &copy; <?php echo date('Y'); ?></p>

<?php wp_footer();?>


enter image description here

Also, code for registering a sidebar in functions.php file

function our_widget_init() {

    'name'=> 'Footer Area 1',
    'id' => 'footer_1',
    'before_widget' => '<div>',
    'after_widget' => '</div',
    'before_title' => '<h2>',
    'after_title' => '</h2>'
add_action('widgets_init', 'our_widget_init');
  • What's your code for registering the 'footer_1' sidebar? Jan 24, 2019 at 10:25
  • Sorry, added it to the end of the post
    – zxdmac
    Jan 24, 2019 at 11:25

1 Answer 1


You're missing > in the closing div, for after_widget:

'after_widget' => '</div',

Needs to be:

'after_widget' => '</div>',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.