choices ) ) { return; } $name = '_customize-radio-' . $this->id; ?> label ); ?> description ) ) : ?> description ); ?>
choices as $value => $label ) : ?>
add_panel( 'general_layouts', array( 'title' => esc_html__( 'General Layouts', 'auspicious' ), 'priority' => 10, ) ); $wp_customize->add_section( 'global_layout', array( 'title' => esc_html__( 'General Layout', 'auspicious' ), 'panel' => 'general_layouts', 'priority' => 5, ) ); $wp_customize->add_setting( 'global_layout', array( 'default' => 'left-sidebar', 'sanitize_callback' => 'Benlumia007\Backdrop\ThemeLayout\sanitize_layouts', 'transport' => 'refresh', 'type' => 'theme_mod', ) ); $wp_customize->add_control( new Control_Radio_Image( $wp_customize, 'global_layout', array( 'label' => esc_html__( 'General Layout', 'auspicious' ), 'description' => esc_html__( 'General Layout applies to all layouts that supports in this theme.', 'auspicious' ), 'section' => 'global_layout', 'settings' => 'global_layout', 'type' => 'radio-image', 'choices' => array( 'left-sidebar' => get_theme_file_uri( '/vendor/benlumia007/backdrop-core/src/assets/images/2cl.png' ), 'right-sidebar' => get_theme_file_uri( '/vendor/benlumia007/backdrop-core/src/assets/images/2cr.png' ), 'no-sidebar' => get_theme_file_uri( '/vendor/benlumia007/backdrop-core/src/assets/images/1col.png' ), ), ) ) ); } add_action( 'customize_register', __NAMESPACE__ . '\load_theme_layout_selector' ); /** * * 3.0 - Customize (Theme Layout (Validation)) * * @param string $input ot a object. */ function sanitize_layouts( $input ) { $choices = array( 'left-sidebar', 'right-sidebar', 'no-sidebar', ); if ( in_array( $input, $choices, true ) ) { return $input; } else { return 'left-sidebar'; } }