add_section( 'attorney_hero_section' , array( 'title' => __( 'Hero', 'attorney' ), 'priority' => 32, 'description' => __( 'Customize the hero here.', 'attorney' ), ) ); $wp_customize->add_setting( 'attorney_hero_show_image_or_color', array( 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'attorney_hero_show_image_or_color', array( 'label' => esc_html__( 'Select whether you want to show an image or a color on the hero', 'attorney' ), 'section' => 'attorney_hero_section', 'type' => 'select', 'choices' => array( 'image' => esc_html__('Show Image','attorney'), 'static_color' => esc_html__('Show Static Color','attorney'), ) ) ); $wp_customize->add_setting( 'attorney_hero_image', array( 'default' => get_theme_file_uri('assets/dev/img/default-hero.jpg'), // Add Default Image URL 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'attorney_hero_image_control', array( 'label' => 'Upload Hero Image', 'priority' => 20, 'section' => 'attorney_hero_section', 'settings' => 'attorney_hero_image', 'button_labels' => array(// All These labels are optional 'select' => 'Select Image', 'remove' => 'Remove Image', 'change' => 'Change Image', ) ))); $wp_customize->add_setting( 'attorney_hero_color', array( 'default' => '#808080', 'sanitize_callback' => 'sanitize_hex_color', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'attorney_hero_color', array( 'label' => 'Hero Background Color', 'section' => 'attorney_hero_section', 'settings' => 'attorney_hero_color' ))); } endif; add_action('customize_register', 'attorney_theme_customize_hero');