WP_Customize_Header_Image_Control::print_header_image_template()

Source

public function print_header_image_template() {
	?>
	<script type="text/template" id="tmpl-header-choice">
		<# if (data.random) { #>
		<button type="button" class="button display-options random">
			<span class="dashicons dashicons-randomize dice"></span>
			<# if ( data.type === 'uploaded' ) { #>
				<?php _e( 'Randomize uploaded headers' ); ?>
			<# } else if ( data.type === 'default' ) { #>
				<?php _e( 'Randomize suggested headers' ); ?>
			<# } #>
		</button>

		<# } else { #>

		<button type="button" class="choice thumbnail"
			data-customize-image-value="{{data.header.url}}"
			data-customize-header-image-data="{{JSON.stringify(data.header)}}">
			<span class="screen-reader-text">
				<?php
				/* translators: Hidden accessibility text. */
				_e( 'Set image' );
				?>
			</span>
			<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />
		</button>

		<# if ( data.type === 'uploaded' ) { #>
			<button type="button" class="dashicons dashicons-no close">
				<span class="screen-reader-text">
					<?php
					/* translators: Hidden accessibility text. */
					_e( 'Remove image' );
					?>
				</span>
			</button>
		<# } #>

		<# } #>
	</script>

	<script type="text/template" id="tmpl-header-current">
		<# if (data.choice) { #>
			<# if (data.random) { #>

		<div class="placeholder">
			<span class="dashicons dashicons-randomize dice"></span>
			<# if ( data.type === 'uploaded' ) { #>
				<?php _e( 'Randomizing uploaded headers' ); ?>
			<# } else if ( data.type === 'default' ) { #>
				<?php _e( 'Randomizing suggested headers' ); ?>
			<# } #>
		</div>

			<# } else { #>

		<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />

			<# } #>
		<# } else { #>

		<div class="placeholder">
			<?php _e( 'No image set' ); ?>
		</div>

		<# } #>
	</script>
	<?php
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.