WP_Customize_Background_Image_Control not working
-
Hello guys,
I am having trouble using this class WP_Customize_Background_Image_Control in theme customizer.What I want to do is add a background image that user can choose. But when try to add that field it’s not working.
But when I use WP_Customize_Color_Control instead of WP_Customize_Background_Image_Control it is working ok, I am getting field for changing color.Code is at the bottom.
Thank youadd_action ('admin_menu', 'themedemo_admin'); function themedemo_admin() { // add the Customize link to the admin menu add_theme_page( 'Customize', 'Customize', 'edit_theme_options', 'customize.php' ); } add_action('customize_register', 'theme_customize'); function theme_customize($wp_customize) { $wp_customize->add_section( 'site_colors', array( 'title' => 'Colors', 'priority' => 35, ) ); $wp_customize->add_setting( 'header_color', array( ) ); $wp_customize->add_control( new WP_Customize_Background_Image_Control( $wp_customize, 'control_id', array( 'label' => __( 'Header Color', 'mytheme' ), 'section' => 'site_colors', 'settings' => 'header_color', ) ) ); $wp_customize->get_setting( 'header_color' )->transport = 'postMessage'; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP_Customize_Background_Image_Control not working’ is closed to new replies.