Twenty Fourteen: sanitize the values of Featured Content layout option, props kwight. Fixes #26408.
Built from https://develop.svn.wordpress.org/trunk@26636 git-svn-id: http://core.svn.wordpress.org/trunk@26526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dbe43017b5
commit
9464a4aa1a
|
@ -48,6 +48,7 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
||||||
// Add the featured content layout setting and control.
|
// Add the featured content layout setting and control.
|
||||||
$wp_customize->add_setting( 'featured_content_layout', array(
|
$wp_customize->add_setting( 'featured_content_layout', array(
|
||||||
'default' => 'grid',
|
'default' => 'grid',
|
||||||
|
'sanitize_callback' => 'twentyfourteen_sanitize_layout',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$wp_customize->add_control( 'featured_content_layout', array(
|
$wp_customize->add_control( 'featured_content_layout', array(
|
||||||
|
@ -62,6 +63,21 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
||||||
}
|
}
|
||||||
add_action( 'customize_register', 'twentyfourteen_customize_register' );
|
add_action( 'customize_register', 'twentyfourteen_customize_register' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize the Featured Content layout value.
|
||||||
|
*
|
||||||
|
* @since Twenty Fourteen 1.0
|
||||||
|
*
|
||||||
|
* @param string $layout Layout type.
|
||||||
|
* @return string Filtered layout type (grid|slider).
|
||||||
|
*/
|
||||||
|
function twentyfourteen_sanitize_layout( $layout ) {
|
||||||
|
if ( ! in_array( $layout, array( 'grid', 'slider' ) ) )
|
||||||
|
$layout = 'grid';
|
||||||
|
|
||||||
|
return $layout;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
|
* Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue