Merge pull request #793 from IanDelMar/patch-10
Stick to single quotes & other minor changes
👍
This commit is contained in:
commit
613f16e462
|
@ -40,19 +40,25 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
'priority' => 160,
|
'priority' => 160,
|
||||||
) );
|
) );
|
||||||
|
|
||||||
//select sanitization function
|
/**
|
||||||
function understrap_theme_slug_sanitize_select( $input, $setting ){
|
* Select sanitization function
|
||||||
|
*
|
||||||
//input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only
|
* @param string $input Slug to sanitize.
|
||||||
$input = sanitize_key($input);
|
* @param WP_Customize_Setting $setting Setting instance.
|
||||||
|
* @return string Sanitized slug if it is a valid choice; otherwise, the setting default.
|
||||||
//get the list of possible select options
|
*/
|
||||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
function understrap_theme_slug_sanitize_select( $input, $setting ){
|
||||||
|
|
||||||
//return input if valid or return default option
|
// Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only).
|
||||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
$input = sanitize_key( $input );
|
||||||
|
|
||||||
}
|
// Get the list of possible select options.
|
||||||
|
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||||
|
|
||||||
|
// If the input is a valid key, return it; otherwise, return the default.
|
||||||
|
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$wp_customize->add_setting( 'understrap_container_type', array(
|
$wp_customize->add_setting( 'understrap_container_type', array(
|
||||||
'default' => 'container',
|
'default' => 'container',
|
||||||
|
@ -66,7 +72,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
$wp_customize,
|
$wp_customize,
|
||||||
'understrap_container_type', array(
|
'understrap_container_type', array(
|
||||||
'label' => __( 'Container Width', 'understrap' ),
|
'label' => __( 'Container Width', 'understrap' ),
|
||||||
'description' => __( "Choose between Bootstrap's container and container-fluid", 'understrap' ),
|
'description' => __( 'Choose between Bootstrap\'s container and container-fluid', 'understrap' ),
|
||||||
'section' => 'understrap_theme_layout_options',
|
'section' => 'understrap_theme_layout_options',
|
||||||
'settings' => 'understrap_container_type',
|
'settings' => 'understrap_container_type',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
@ -90,7 +96,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
$wp_customize,
|
$wp_customize,
|
||||||
'understrap_sidebar_position', array(
|
'understrap_sidebar_position', array(
|
||||||
'label' => __( 'Sidebar Positioning', 'understrap' ),
|
'label' => __( 'Sidebar Positioning', 'understrap' ),
|
||||||
'description' => __( "Set sidebar's default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.",
|
'description' => __( 'Set sidebar\'s default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.',
|
||||||
'understrap' ),
|
'understrap' ),
|
||||||
'section' => 'understrap_theme_layout_options',
|
'section' => 'understrap_theme_layout_options',
|
||||||
'settings' => 'understrap_sidebar_position',
|
'settings' => 'understrap_sidebar_position',
|
||||||
|
@ -118,7 +124,8 @@ if ( ! function_exists( 'understrap_customize_preview_js' ) ) {
|
||||||
*/
|
*/
|
||||||
function understrap_customize_preview_js() {
|
function understrap_customize_preview_js() {
|
||||||
wp_enqueue_script( 'understrap_customizer', get_template_directory_uri() . '/js/customizer.js',
|
wp_enqueue_script( 'understrap_customizer', get_template_directory_uri() . '/js/customizer.js',
|
||||||
array( 'customize-preview' ), '20130508', true );
|
array( 'customize-preview' ), '20130508', true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action( 'customize_preview_init', 'understrap_customize_preview_js' );
|
add_action( 'customize_preview_init', 'understrap_customize_preview_js' );
|
||||||
|
|
Reference in New Issue