• I copied code for Twentyseventeen-child function.php on how to add a sidebar to page.php.
    I know that the page.php is not causing the error nor any other files used in child thembe because I have added them one by one without any coding in functions.php except wht is required for enreque.

    Here is my code found functions.php file

    <?php 
    function childtheme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', 
    get_template_directory_uri() . '/style.css' );
    
    wp_enqueue_style( 'child-style',
    get_stylesheet_directory_uri() . '/style.css',
    array( 'parent-style' ),
    wp_get_theme()->get('Version')
    );
    }
    add_action( 'wp_enqueue_scripts', 'childtheme_enqueue_styles' );
    function twentyseventeen_body_classes_child( $classes ){
    if ( is_active_sidebar( 'sidebar-1' ) &&  is_page() ) {
    		$classes[] = 'has-sidebar';
    	}
    	return $classes;
    }
    add_filter( 'body_class', 'twentyseventeen_body_classes_child' );
    ?>	 

    I have been trying for a while and do not know what I am doing wrong.
    Help from someone would be very much appreciated.

    I like TwentySeventeen. It is really cool to use. I just want to be able to add sidebars to page. But I get a 302 error when activating the child theme which is caused by the functions.php file. I do not understand why.

    Thanks for much for some direction.

Viewing 1 replies (of 1 total)
  • Try this for a simple fix…the plugin ‘Advanced Twenty Seventeen’ comes with a built in child theme. All you need to do is install/activate the plugin then go to your theme menu and change your active theme to the child.

Viewing 1 replies (of 1 total)
  • The topic ‘TwentySeventeen-child Theme function.php error’ is closed to new replies.