Make WordPress Core


Ignore:
Timestamp:
03/25/2012 09:18:32 PM (15 years ago)
Author:
koopersmith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize.php

    r20278 r20290  
    543543                                'removed'        => 'remove-header',
    544544                                'get_url'        => 'get_header_image',
     545                                'tabs'           => array(
     546                                        array( 'uploaded', __('Uploaded'), 'wp_customize_print_uploaded_headers' ),
     547                                        array( 'included', __('Included'), 'wp_customize_print_included_headers' ),
     548                                ),
    545549                        ),
    546550                ) );
    … …  
    720724        return $color;
    721725}
     726
     727function wp_customize_print_uploaded_headers() {
     728        $headers = get_uploaded_header_images();
     729
     730        foreach ( $headers as $header ) : ?>
     731                <a href="<?php echo esc_url( $header['url'] ); ?>">
     732                        <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
     733                </a>
     734        <?php endforeach;
     735}
     736
     737function wp_customize_print_included_headers() {
     738        global $custom_image_header;
     739        $custom_image_header->process_default_headers();
     740
     741        foreach ( $custom_image_header->default_headers as $header ) : ?>
     742                <a href="<?php echo esc_url( $header['url'] ); ?>">
     743                        <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
     744                </a>
     745        <?php endforeach;
     746}
Note: See TracChangeset for help on using the changeset viewer.