I'm using Underscores to build a theme and I've added an image selector to the customization section, which appears just like the default Background Image section, except clicking 'Select Image' doesn't bring up the media library for some reason. Here's the code I'm using:
function hi_customization_options( $wp_customize ) {
$wp_customize->add_section(
'landing_page_image',
array(
'title' => 'Landing Page Image',
'priority' => 35,
)
);
$wp_customize->add_setting(
'lp-image_selector',
array(
'default' => '',
)
);
$wp_customize->add_control(
'lp-image_selector',
array(
'label' => 'Landing Page Image',
'section' => 'landing_page_image',
'type' => 'image',
)
);
}
add_action( 'customize_register', 'hi_customization_options' );
Presumably I need to add a 'choices' array to the add_control section, but I'm not sure how to target the media library?
Thanks
Aucun commentaire:
Enregistrer un commentaire