WP_Customize_Header_Image_Control::render_content()

In this article

Source

public function render_content() {
	$visibility = $this->get_current_image_src() ? '' : ' style="display:none" ';
	$width      = absint( get_theme_support( 'custom-header', 'width' ) );
	$height     = absint( get_theme_support( 'custom-header', 'height' ) );
	?>
	<div class="customize-control-content">
		<?php
		if ( current_theme_supports( 'custom-header', 'video' ) ) {
			echo '<span class="customize-control-title">' . $this->label . '</span>';
		}
		?>
		<div class="customize-control-notifications-container"></div>
		<p class="customizer-section-intro customize-control-description">
			<?php
			if ( current_theme_supports( 'custom-header', 'video' ) ) {
				_e( 'Click &#8220;Add New Image&#8221; to upload an image file from your computer. Your theme works best with an image that matches the size of your video &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' );
			} elseif ( $width && $height ) {
				printf(
					/* translators: %s: Header size in pixels. */
					__( 'Click &#8220;Add New Image&#8221; to upload an image file from your computer. Your theme works best with an image with a header size of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
					sprintf( '<strong>%s &times; %s</strong>', $width, $height )
				);
			} elseif ( $width ) {
				printf(
					/* translators: %s: Header width in pixels. */
					__( 'Click &#8220;Add New Image&#8221; to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
					sprintf( '<strong>%s</strong>', $width )
				);
			} else {
				printf(
					/* translators: %s: Header height in pixels. */
					__( 'Click &#8220;Add New Image&#8221; to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
					sprintf( '<strong>%s</strong>', $height )
				);
			}
			?>
		</p>
		<div class="current">
			<label for="header_image-button">
				<span class="customize-control-title">
					<?php _e( 'Current header' ); ?>
				</span>
			</label>
			<div class="container">
			</div>
		</div>
		<div class="actions">
			<?php if ( current_user_can( 'upload_files' ) ) : ?>
			<button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e( 'Hide header image' ); ?>"><?php _e( 'Hide image' ); ?></button>
			<button type="button" class="button new" id="header_image-button" aria-label="<?php esc_attr_e( 'Add New Header Image' ); ?>"><?php _e( 'Add New Image' ); ?></button>
			<?php endif; ?>
		</div>
		<div class="choices">
			<span class="customize-control-title header-previously-uploaded">
				<?php _ex( 'Previously uploaded', 'custom headers' ); ?>
			</span>
			<div class="uploaded">
				<div class="list">
				</div>
			</div>
			<span class="customize-control-title header-default">
				<?php _ex( 'Suggested', 'custom headers' ); ?>
			</span>
			<div class="default">
				<div class="list">
				</div>
			</div>
		</div>
	</div>
	<?php
}

User Contributed Notes

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