Default image not appearing in WP_Customize_Media_Control
-
Hello,
Default image set in
WP_Customize_Media_Control
‘s setting isn’t appearing in the Customizer.Here’s the code I’ve added inside in twentyseventeen_customize_register() of wp-content/themes/twentyseventeen/inc/customizer.php:
/** * My Test. */ $wp_customize->add_section( 'my-settings', array( 'description' => __( 'Use the included default image or personalize your site by uploading your own image.<br /><br />The default images is <strong>1600 pixels wide and 1050 pixels tall</strong>.', 'twentyseventeen' ), 'title' => __( 'My Section Background Image', 'twentyseventeen' ), ) ); $wp_customize->add_setting( 'my-custom-image', array( 'default' => sprintf( '%s/assets/images/sandwich.jpg', get_template_directory_uri() ), 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'my-custom-image',array( 'section' => 'my-settings', 'label' => sprintf( __( 'My Section Image:', 'twentyseventeen' ), $image ), ) ) );
Full code: https://pastebin.com/raw/ajyXmnBY
What I expect to see:
What I see:
If I replace
WP_Customize_Media_Control
withWP_Customize_Image_Control
, the default image appears fine.Any idea?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Default image not appearing in WP_Customize_Media_Control’ is closed to new replies.