Title: Custom_Image_Header::show_header_selector
Published: April 25, 2014
Last modified: February 24, 2026

---

# Custom_Image_Header::show_header_selector( string $type )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#wp--skip-link--target)

Displays UI for selecting one of several default headers.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#description)󠁿

Shows the random image option if this theme has multiple header images.
Random image
option is on by default if no header has been set.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#parameters)󠁿

 `$type`stringrequired

The header type. One of `'default'` (for the Uploaded Images control) or `'uploaded'`(
for the Uploaded Images control).

## 󠀁[Source](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#source)󠁿

    ```php
    public function show_header_selector( $type = 'default' ) {
    	if ( 'default' === $type ) {
    		$headers = $this->default_headers;
    	} else {
    		$headers = get_uploaded_header_images();
    		$type    = 'uploaded';
    	}

    	if ( 1 < count( $headers ) ) {
    		echo '<div class="random-header">';
    		echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />';
    		_e( '<strong>Random:</strong> Show a different image on each page.' );
    		echo '</label>';
    		echo '</div>';
    	}

    	echo '<div class="available-headers">';

    	foreach ( $headers as $header_key => $header ) {
    		$header_thumbnail = $header['thumbnail_url'];
    		$header_url       = $header['url'];
    		$header_alt_text  = empty( $header['alt_text'] ) ? '' : $header['alt_text'];

    		echo '<div class="default-header">';
    		echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
    		$width = '';
    		if ( ! empty( $header['attachment_id'] ) ) {
    			$width = ' width="230"';
    		}
    		echo '<img src="' . esc_url( set_url_scheme( $header_thumbnail ) ) . '" alt="' . esc_attr( $header_alt_text ) . '"' . $width . ' /></label>';
    		echo '</div>';
    	}

    	echo '<div class="clear"></div></div>';
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-custom-image-header.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/class-custom-image-header.php#L314)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-custom-image-header.php#L314-L348)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#related)󠁿

| Uses | Description | 
| [get_uploaded_header_images()](https://developer.wordpress.org/reference/functions/get_uploaded_header_images/)`wp-includes/theme.php` |

Gets the header images uploaded for the active theme.

  | 
| [is_random_header_image()](https://developer.wordpress.org/reference/functions/is_random_header_image/)`wp-includes/theme.php` |

Checks if random header image is in use.

  | 
| [get_theme_mod()](https://developer.wordpress.org/reference/functions/get_theme_mod/)`wp-includes/theme.php` |

Retrieves theme modification value for the active theme.

  | 
| [checked()](https://developer.wordpress.org/reference/functions/checked/)`wp-includes/general-template.php` |

Outputs the HTML checked attribute.

  | 
| [set_url_scheme()](https://developer.wordpress.org/reference/functions/set_url_scheme/)`wp-includes/link-template.php` |

Sets the scheme for a URL.

  | 
| [_e()](https://developer.wordpress.org/reference/functions/_e/)`wp-includes/l10n.php` |

Displays translated text.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  |

[Show 3 more](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#)

| Used by | Description | 
| [Custom_Image_Header::step_1()](https://developer.wordpress.org/reference/classes/custom_image_header/step_1/)`wp-admin/includes/class-custom-image-header.php` |

Displays first step of custom header image page.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/custom_image_header/show_header_selector/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fcustom_image_header%2Fshow_header_selector%2F)
before being able to contribute a note or feedback.