'Left', 'right' => 'Right', ); if ( is_active_sidebar( 'sidebar-1' ) && is_active_sidebar( 'sidebar-2' ) ) { $choices = array_merge( $choices, array( 'both' => 'Left and Right' ) ); } $wp_customize->add_section( 'my_life_theme_options', array( 'title' => __( 'Theme Options', 'my-life' ), 'priority' => 35, ) ); $wp_customize->add_setting( 'sidebar_placement', array( 'default' => 'right', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'sidebar_placement', array( 'label' => __( 'Sidebar Placement:', 'my-life' ), 'section' => 'my_life_theme_options', 'type' => 'select', 'choices' => $choices, ) ); $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; } add_action( 'customize_register', 'my_life_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. * * @since My Life 1.0 */ function my_life_customize_preview_js() { wp_enqueue_script( 'my_life_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20120123', true ); } add_action( 'customize_preview_init', 'my_life_customize_preview_js' );