get_custom_header

Get the header image data.

Description

(object) get_custom_header(); 

Returns (object)


Usage

  1. if ( !function_exists( 'get_custom_header' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_custom_header(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/theme.php  
  1. function get_custom_header() { 
  2. global $_wp_default_headers; 
  3.  
  4. } else { 
  5. $data = get_theme_mod( 'header_image_data' ); 
  6. if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) { 
  7. $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() ); 
  8. $data = array(); 
  9. $data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args ); 
  10. if ( ! empty( $_wp_default_headers ) ) { 
  11. foreach ( (array) $_wp_default_headers as $default_header ) { 
  12. $url = vsprintf( $default_header['url'], $directory_args ); 
  13. if ( $data['url'] == $url ) { 
  14. $data = $default_header; 
  15. $data['url'] = $url; 
  16. $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); 
  17. break; 
  18.  
  19. $default = array( 
  20. 'url' => '',  
  21. 'thumbnail_url' => '',  
  22. 'width' => get_theme_support( 'custom-header', 'width' ),  
  23. 'height' => get_theme_support( 'custom-header', 'height' ),  
  24. 'video' => get_theme_support( 'custom-header', 'video' ),  
  25. ); 
  26. return (object) wp_parse_args( $data, $default );