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">
<p>Child1</p>
<p>Child2</p>
<?php
if(is_active_sidebar('footer_1'))
{
dynamic_sidebar('footer_1');
}
?>
</div> <!-- End of footer-widget -->
<nav class="site-nav">
<?php
$arg = array(
'theme_location' => 'footer',
'menu_class' => 'navigation'
);
?>
<?php wp_nav_menu($args); ?>
</nav>
<p><?php bloginfo('name');?> © <?php echo date('Y'); ?></p>
</footer>
<?php wp_footer();?>
</body>
</html>
Also, code for registering a sidebar in functions.php file
function our_widget_init() {
register_sidebar(array(
'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');