How to enable admin to upload multiple images to support header carousel slider theme in WordPress?
I am creating a Bootstrap Carousel WordPress Theme. Thus Carousel Slider at the top of the pages is a part of theme which should be supported out of the box. That's why creating a separate plugin might not be a good choice, I think.
If I enable Custom Headers
in my theme as following, admin can upload multiple images using WordPress theme Customizer. But only one image is meant to be used as header image.
function themename_custom_header_setup() {
$args = array(
'default-image' = get_template_directory_uri() . 'img/default-image.jpg',
'default-text-color' = '000',
'width' = 1000,
'height' = 250,
'flex-width' = true,
'flex-height' = true,
)
add_theme_support( 'custom-header', $args );
}
add_action( 'after_setup_theme', 'themename_custom_header_setup' );
If I then use get_uploaded_header_images()
function, I can get all header images which have been uploaded via the WordPress theme Customizer but there, admin cannot add extra texts along with the image which will be shown on the images in the carousel slider.
I cannot use the Alt
, Caption
or Description
input fields when uploading images via Media
because images in the Media
can be reused for other purposes on other places of the pages, so those input fields are generic. They cannot be used for header carousel slider specifically.
How can I enable admin to upload multiple images along with texts via the WordPress theme Customizer to support Header Carousel Slider theme without creating a separate plugin?
Topic theme-customizer custom-header theme-development Wordpress
Category Web