• Hello,

    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

    • This topic was modified 6 years, 7 months ago by fernanf.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changes in the child theme’ is closed to new replies.