Theme Customizer: Add 'choose image' functionality to image controls. Rough first pass, using header images as an example. see #19910.

git-svn-id: https://develop.svn.wordpress.org/trunk@20290 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-03-25 21:18:32 +00:00
parent 76e4fbee38
commit d8513a5ebb
4 changed files with 141 additions and 2 deletions

View File

@@ -542,6 +542,10 @@ final class WP_Customize {
'context' => 'custom-header',
'removed' => 'remove-header',
'get_url' => 'get_header_image',
'tabs' => array(
array( 'uploaded', __('Uploaded'), 'wp_customize_print_uploaded_headers' ),
array( 'included', __('Included'), 'wp_customize_print_included_headers' ),
),
),
) );
@@ -719,3 +723,24 @@ function sanitize_hexcolor( $color ) {
return $color;
}
function wp_customize_print_uploaded_headers() {
$headers = get_uploaded_header_images();
foreach ( $headers as $header ) : ?>
<a href="<?php echo esc_url( $header['url'] ); ?>">
<img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
</a>
<?php endforeach;
}
function wp_customize_print_included_headers() {
global $custom_image_header;
$custom_image_header->process_default_headers();
foreach ( $custom_image_header->default_headers as $header ) : ?>
<a href="<?php echo esc_url( $header['url'] ); ?>">
<img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
</a>
<?php endforeach;
}