I added a sidebar in header to add a slider. Not sure this is the right way, but this is what I did:
just copied header.php from parent theme to child-theme and I made this changes:
@@ -179,8 +179,10 @@
get_template_part( ‘template-parts/modal-search’ );
}
?>
+ <!– Barra dinamica in cui includo lo slider –>
</header><!– #site-header –>
+ <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘header_sidebar’) ) : endif; ?>
<?php
// Output the menu modal.
get_template_part( ‘template-parts/modal-menu’ );
Then, in child-theme functions.php I wrote:
function header_widgets_init() {
register_sidebar( array(
‘name’ => ‘Header Sidebar’,
‘id’ => ‘header_sidebar’,
‘before_widget’ => ‘<aside class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h2 class=”widget-title”>’,
‘after_title’ => ‘</h2>’,
) );
}
add_action( ‘widgets_init’, ‘header_widgets_init’ );