So inside this theme I'm making for a client there is a section inside the customizer that allows them to change a header on each individual page, my question is how do I fetch the alt tag of that Image?
The Images are uploaded through the Media Library so the alt text has been set after the Image was uploaded.
Below is what I have tried to fetch the Image alt tag
$img_id = get_post_thumbnail_id(get_the_ID()); $alt_text = get_post_meta($img_id , '_wp_attachment_image_alt', true); <img src="<?php echo get_theme_mod('about-header', get_stylesheet_directory_uri() . '/assests/imgs/placeholder.png'); ?>" alt="<?php echo $alt_text; ?>">
For some reason it just doesn't seem to get the Images alt tag and I don't understand why
Code for the Customizer (just in case I have to do something inside there)
$wp_customize->add_section('page_header', array( 'title' => __('Page Headers', 'bissell-theme'), 'priority' => 30, 'description' => __('Below are the options to change your header images for all your pages. Just simply click \'Select Image\' and choose a Image from the Media Libary or Upload one your self'), )); $wp_customize->add_setting('about-header'); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'about_header_control', array( 'label' => __('About Us - Header'), 'section' => 'page_header', 'settings' => 'about-header', )));