Make WordPress Core


Ignore:
Timestamp:
12/04/2013 09:32:48 PM (11 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: sanitize the values of Featured Content layout option, props kwight. Fixes #26408.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/inc/customizer.php

    r26630 r26636  
    4848    // Add the featured content layout setting and control.
    4949    $wp_customize->add_setting( 'featured_content_layout', array(
    50         'default' => 'grid',
     50        'default'           => 'grid',
     51        'sanitize_callback' => 'twentyfourteen_sanitize_layout',
    5152    ) );
    5253
     
    6263}
    6364add_action( 'customize_register', 'twentyfourteen_customize_register' );
     65
     66/**
     67 * Sanitize the Featured Content layout value.
     68 *
     69 * @since Twenty Fourteen 1.0
     70 *
     71 * @param string $layout Layout type.
     72 * @return string Filtered layout type (grid|slider).
     73 */
     74function twentyfourteen_sanitize_layout( $layout ) {
     75    if ( ! in_array( $layout, array( 'grid', 'slider' ) ) )
     76        $layout = 'grid';
     77
     78    return $layout;
     79}
    6480
    6581/**
Note: See TracChangeset for help on using the changeset viewer.