title: How to generate header image alt text in a custom WordPress theme?
body: <p>I am building a custom WordPress theme without plugins. The header image for each page may be different, so I am using the dashboard to assign the image and calling the "get_header_image()" function in my theme's code. The header image is properly displayed, but the alt text is not.</p>
  
  <p>I wrote the following code:</p>
  
  <pre><code>function alt_text_display() {
      $header_id = get_header_image(get_the_ID());
      $alt = get_post_meta($header_id, 'wp_get_attachment_image_alt', true);
      echo $alt;
  }
  
  add_action( 'wp_enqueue_scripts', 'alt_text_display' );
  </code></pre>
  
  <p>It doesn't work, probably because get_header_iamge() doesn't take arguments, right?</p>
  
  <p>My HTML looks like this:</p>
  
  <pre><code>    &lt;div class="hero_container"&gt;
            &lt;img src="&lt;?php echo( get_header_image() ); ?&gt;" class="hero"&gt;
       &lt;/div&gt;
  </code></pre>
  
  <p>I set the image's alt text when I uploaded it to the media library. That text is not showing. Instead, the site's title is showing. How do I display the alt text that I set in the Media Library?</p>