diff --git a/wp-content/themes/twentyfourteen/inc/customizer.php b/wp-content/themes/twentyfourteen/inc/customizer.php index 1631117207..a9b316e55e 100644 --- a/wp-content/themes/twentyfourteen/inc/customizer.php +++ b/wp-content/themes/twentyfourteen/inc/customizer.php @@ -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. *