WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/24/2016 10:09:54 PM (4 years ago)
Author:
obenland
Message:

Customize: Introduce Logo support for themes.

Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/

Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-site-icon-control.php

    r35389 r36698  
    4242        add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 );
    4343    }
     44
     45    /**
     46     * Render a JS template for the content of the site icon control.
     47     *
     48     * @since 4.5.0
     49     */
     50    public function content_template() {
     51        ?>
     52        <label for="{{ data.settings['default'] }}-button">
     53            <# if ( data.label ) { #>
     54                <span class="customize-control-title">{{ data.label }}</span>
     55            <# } #>
     56            <# if ( data.description ) { #>
     57                <span class="description customize-control-description">{{{ data.description }}}</span>
     58            <# } #>
     59        </label>
     60
     61        <# if ( data.attachment && data.attachment.id ) { #>
     62        <div class="current">
     63            <div class="container">
     64                <div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }} site-icon-preview">
     65                    <strong><?php _e( 'As a browser icon' ); ?></strong>
     66                    <div class="favicon-preview">
     67                        <img src="images/browser.png" class="browser-preview" width="182" height="" alt="" />
     68
     69                        <div class="favicon">
     70                            <img id="preview-favicon" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
     71                        </div>
     72                        <span class="browser-title"><?php bloginfo( 'name' ); ?></span>
     73                    </div>
     74
     75                    <strong><?php _e( 'As an app icon' ); ?></strong>
     76                    <p class="app-icon-preview">
     77                        <img id="preview-app-icon" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
     78                    </p>
     79                </div>
     80            </div>
     81        </div>
     82        <div class="actions">
     83            <# if ( data.canUpload ) { #>
     84                <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
     85                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
     86                <div style="clear:both"></div>
     87            <# } #>
     88        </div>
     89        <# } else { #>
     90        <div class="current">
     91            <div class="container">
     92                <div class="placeholder">
     93                    <div class="inner">
     94                        <span><?php echo $this->button_labels['placeholder']; ?></span>
     95                    </div>
     96                </div>
     97            </div>
     98        </div>
     99        <div class="actions">
     100            <# if ( data.defaultAttachment ) { #>
     101                <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
     102            <# } #>
     103            <# if ( data.canUpload ) { #>
     104                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
     105            <# } #>
     106            <div style="clear:both"></div>
     107        </div>
     108        <# } #>
     109        <?php
     110    }
    44111}
Note: See TracChangeset for help on using the changeset viewer.