Home / APIs / Custom_Image_Header::show_header_selector() – Display UI for selecting one of several default headers.

You appear to be a bot. Output may be restricted

Description

Display UI for selecting one of several default headers.

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

Usage

Custom_Image_Header::show_header_selector( $type );

Parameters

$type
( string ) optional default: default – The header type. One of 'default' (for the Uploaded Images control) or 'uploaded' (for the Uploaded Images control).

Returns

void

Source

File name: wordpress/wp-admin/custom-header.php
Lines: 1 to 31 of 31

  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="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'"' . $width . ' /></label>';
      echo '</div>';
    }
    echo '<div class="clear"></div></div>';
  }
 

 View on GitHub View on Trac

Published: 12th March 2017 | Last updated: 12th March 2017

Information

Function name: Custom_Image_Header::show_header_selector
Class ref: Custom_Image_Header
Plugin ref: WordPress
Version: 5.0.3
Sourcefile: wp-admin/custom-header.php
File ref: wp-admin/custom-header.php
Deprecated?: No
API Letters: C,H,I,S

  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Files
  • Hooks
  • Classes
  • Sites
  • Sitemap
  • Blog
WooCommerce a2z WooCommerce a2z
WooCommerce

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins