WordPress.org

Making WordPress.org

Changeset 3196


Ignore:
Timestamp:
05/20/2016 05:50:02 PM (6 years ago)
Author:
obenland
Message:

Plugin Directory: Bring Customizer enhancements into the namespace.

See #1719.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r3193 r3196  
    110110
    111111/**
     112 * Add postMessage support for site title and description for the Theme Customizer.
     113 *
     114 * @param \WP_Customize_Manager $wp_customize Theme Customizer object.
     115 */
     116function customize_register( $wp_customize ) {
     117    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
     118    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     119}
     120add_action( 'customize_register', __NAMESPACE__ . '\customize_register' );
     121
     122/**
     123 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
     124 */
     125function customize_preview_js() {
     126    wp_enqueue_script( 'wporg_plugins_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
     127}
     128add_action( 'customize_preview_init',  __NAMESPACE__ . '\customize_preview_js' );
     129
     130/**
    112131 * Custom template tags for this theme.
    113132 */
    114133require get_template_directory() . '/inc/template-tags.php';
    115 
    116 /**
    117  * Customizer additions.
    118  */
    119 require get_template_directory() . '/inc/customizer.php';
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/customizer.js

    r3193 r3196  
    2020        } );
    2121    } );
    22 
    23     // Header text color.
    24     wp.customize( 'header_textcolor', function( value ) {
    25         value.bind( function( to ) {
    26             if ( 'blank' === to ) {
    27                 $( '.site-title a, .site-description' ).css( {
    28                     'clip': 'rect(1px, 1px, 1px, 1px)',
    29                     'position': 'absolute'
    30                 } );
    31             } else {
    32                 $( '.site-title a, .site-description' ).css( {
    33                     'clip': 'auto',
    34                     'position': 'relative'
    35                 } );
    36                 $( '.site-title a, .site-description' ).css( {
    37                     'color': to
    38                 } );
    39             }
    40         } );
    41     } );
    4222} )( jQuery );
Note: See TracChangeset for help on using the changeset viewer.