Twenty Fifteen: Minor formatting and docs tweaks, clearer variable name.
Props celloexpressions, see #29988 git-svn-id: https://develop.svn.wordpress.org/trunk@30305 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8454637689
commit
88e80131df
|
@ -17,8 +17,8 @@
|
||||||
function twentyfifteen_customize_register( $wp_customize ) {
|
function twentyfifteen_customize_register( $wp_customize ) {
|
||||||
$color_scheme = twentyfifteen_get_color_scheme();
|
$color_scheme = twentyfifteen_get_color_scheme();
|
||||||
|
|
||||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||||
|
|
||||||
// Add color scheme setting and control.
|
// Add color scheme setting and control.
|
||||||
$wp_customize->add_setting( 'color_scheme', array(
|
$wp_customize->add_setting( 'color_scheme', array(
|
||||||
|
@ -254,7 +254,7 @@ function twentyfifteen_customize_control_js() {
|
||||||
add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
|
add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds JS handlers to make Customizer preview reload changes asynchronously.
|
* Binds JS handlers to make the Customizer preview reload changes asynchronously.
|
||||||
*
|
*
|
||||||
* @since Twenty Fifteen 1.0
|
* @since Twenty Fifteen 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -266,6 +266,9 @@ add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );
|
||||||
/**
|
/**
|
||||||
* Output an Underscore template for generating CSS for the color scheme.
|
* Output an Underscore template for generating CSS for the color scheme.
|
||||||
*
|
*
|
||||||
|
* The template generates the css dynamically for instant display in the Customizer preview,
|
||||||
|
* and to be saved in a `theme_mod` for display on the front-end.
|
||||||
|
*
|
||||||
* @since Twenty Fifteen 1.0
|
* @since Twenty Fifteen 1.0
|
||||||
*/
|
*/
|
||||||
function twentyfifteen_color_scheme_css_template() {
|
function twentyfifteen_color_scheme_css_template() {
|
||||||
|
@ -512,7 +515,7 @@ function twentyfifteen_color_scheme_css_template() {
|
||||||
/* Sidebar Text Color */
|
/* Sidebar Text Color */
|
||||||
.site-title a:hover,
|
.site-title a:hover,
|
||||||
.site-title a:focus {
|
.site-title a:focus {
|
||||||
color: {{ data.sidebar_textcolor2 }};
|
color: {{ data.secondary_sidebar_textcolor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sidebar Border Color */
|
/* Sidebar Border Color */
|
||||||
|
@ -592,7 +595,7 @@ function twentyfifteen_color_scheme_css_template() {
|
||||||
.widget blockquote,
|
.widget blockquote,
|
||||||
.widget .wp-caption-text,
|
.widget .wp-caption-text,
|
||||||
.widget .gallery-caption {
|
.widget .gallery-caption {
|
||||||
color: {{ data.sidebar_textcolor2 }};
|
color: {{ data.secondary_sidebar_textcolor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget button:hover,
|
.widget button:hover,
|
||||||
|
@ -605,11 +608,11 @@ function twentyfifteen_color_scheme_css_template() {
|
||||||
.widget input[type="submit"]:focus,
|
.widget input[type="submit"]:focus,
|
||||||
.widget_calendar tbody a:hover,
|
.widget_calendar tbody a:hover,
|
||||||
.widget_calendar tbody a:focus {
|
.widget_calendar tbody a:focus {
|
||||||
background-color: {{ data.sidebar_textcolor2 }};
|
background-color: {{ data.secondary_sidebar_textcolor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget blockquote {
|
.widget blockquote {
|
||||||
border-color: {{ data.sidebar_textcolor2 }};
|
border-color: {{ data.secondary_sidebar_textcolor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sidebar Border Color */
|
/* Sidebar Border Color */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* global colorScheme */
|
/* global colorScheme */
|
||||||
/**
|
/**
|
||||||
* Add a listener to the Color Scheme control to update other color controls to new values/defaults.
|
* Add a listener to the Color Scheme control to update other color controls to new values/defaults.
|
||||||
|
* Also trigger an update of the Color Scheme CSS when a color is changed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( function( api ) {
|
( function( api ) {
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Generate the CSS for the current Color Scheme.
|
||||||
function getCSS() {
|
function getCSS() {
|
||||||
var scheme = api( 'color_scheme' )(),
|
var scheme = api( 'color_scheme' )(),
|
||||||
colors = _.object( colorSchemeKeys, colorScheme[ scheme ].colors );
|
colors = _.object( colorSchemeKeys, colorScheme[ scheme ].colors );
|
||||||
|
@ -58,7 +60,7 @@
|
||||||
colors['secondary_textcolor'] = Color( colors.textcolor ).toCSS( 'rgba', 0.7 );
|
colors['secondary_textcolor'] = Color( colors.textcolor ).toCSS( 'rgba', 0.7 );
|
||||||
colors['border_color'] = Color( colors.textcolor ).toCSS( 'rgba', 0.1 );
|
colors['border_color'] = Color( colors.textcolor ).toCSS( 'rgba', 0.1 );
|
||||||
colors['border_focus_color'] = Color( colors.textcolor ).toCSS( 'rgba', 0.3 );
|
colors['border_focus_color'] = Color( colors.textcolor ).toCSS( 'rgba', 0.3 );
|
||||||
colors['sidebar_textcolor2'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.7 );
|
colors['secondary_sidebar_textcolor'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.7 );
|
||||||
colors['sidebar_border_color'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.1 );
|
colors['sidebar_border_color'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.1 );
|
||||||
colors['sidebar_border_focus_color'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.3 );
|
colors['sidebar_border_focus_color'] = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.3 );
|
||||||
|
|
||||||
|
|
|
@ -10,19 +10,21 @@
|
||||||
.find( '#twentyfifteen-color-scheme-css' );
|
.find( '#twentyfifteen-color-scheme-css' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Site title and description.
|
// Site title.
|
||||||
wp.customize( 'blogname', function( value ) {
|
wp.customize( 'blogname', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
$( '.site-title a' ).text( to );
|
$( '.site-title a' ).text( to );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Site tagline.
|
||||||
wp.customize( 'blogdescription', function( value ) {
|
wp.customize( 'blogdescription', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
$( '.site-description' ).text( to );
|
$( '.site-description' ).text( to );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Color Scheme CSS.
|
||||||
wp.customize( 'color_scheme_css', function( value ) {
|
wp.customize( 'color_scheme_css', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
$style.html( to );
|
$style.html( to );
|
||||||
|
|
Loading…
Reference in New Issue