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?

  • Pretty much anything you can do with a plugin you can do from your theme's functions.php. So I don't think the separate plugin thing is an issue really. But I don't think it matters either way. – Rup Jan 3 at 1:43
  • It sounds like you want to add extra post meta fields to each image to specifically use for the carousel? That should be possible, and you can probably add the fields to the standard media upload / edit forms too if you can find the right hooks. – Rup Jan 3 at 1:44
  • I am new to WordPress and don't know many WordPress hooks yet. Any advise on what WordPress functions/hooks should I focus to be able to add images upload functionality in the theme Customizer? – O Connor Jan 4 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.