Twenty Fourteen: sanitize the values of Featured Content layout option, props kwight. Fixes #26408.
git-svn-id: https://develop.svn.wordpress.org/trunk@26636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
17c5e87089
commit
5777eeb642
@ -47,7 +47,8 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
||||
|
||||
// Add the featured content layout setting and control.
|
||||
$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(
|
||||
@ -62,6 +63,21 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
||||
}
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user