mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user