Child theme and functions.php
-
Ok. I am using twentytwelve and I have made a child theme from it. In order to keep some settings when upgrading the “mother” theme, I want some of the special functions to stay in a functions.php in the child theme folder.
In twentytwelve there are two sidebars. But, on a special page template I have made in my child theme, I have two extra sidebars. Right now they are registered in twentytwelves functions.php, and these settings will go when I upgrade it.
So… can i just add these into my empty functions.php in my vhild theme in order to keep the sidebars (and then remove these settings from twentytwelves (mother) function.php):function lbs-forside_widgets_init() { register_sidebar( array( 'name' => __( 'Left Sidebar', 'lbs-forside' ), 'id' => 'sidebar-4', 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'lbs-forside' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'Right Sidebar', 'lbs-forside' ), 'id' => 'sidebar-5', 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'lbs-forside' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); }
Right now I have deleted the functions.php in my child theme since my last effort was with the exact same functions.php as in the mother theme, which gave me a fatal error.
- The topic ‘Child theme and functions.php’ is closed to new replies.