Header image (wordpress)

Enable custom header image.

<?php
/**
 * Enable custom header image.
 */
if (function_exists('add_theme_support')) {
  add_theme_support('custom-header');
}
?>

functions.php

Output header image or site name.

<?php
  if (get_header_image()) {
    printf('<img src="%s" alt="%s">', esc_url(get_header_image()), esc_attr(get_bloginfo('name')));
  } else {
    echo esc_html(get_bloginfo('name'));
  }
?>

header.php

< toolbox