I have already created a child theme and this is activated. In the child’s functions.php file, a new widget area was created, dragging the “search” bar to this area. The point is that when I have to activate the parent theme (for any reason) and I need to come back to the child theme, although the area is still created, I no longer see the search command in this area and I have to drag it again. That’s what I need, when I change to the parent theme and return to the child, the system maintains it as it had before in child theme.
I coded the following intructions in child theme (functions.php) and other in parent theme (header.php):
functions.php (child theme):
function create_above_header_right() {
register_sidebar( array(
'name' => __( 'Above Header Right','music' ),
'id' => 'above-header-right',
'description' => __( 'Shows on right side in header.','music' ),
'before_widget' => '<div id="%1$s" class="widget searchbar %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'create_above_header_right');
?>
header.php (parent theme):
/* call Above Header Right widget area */
if ( is_active_sidebar( 'above-header-right' ) ) :
dynamic_sidebar( 'above-header-right' );
endif;
Thank you
]]>Is there a solution to avoid moving the search bar every time I change to the child theme?
]]>