Fix identation
This commit is contained in:
parent
c8274df833
commit
b653d6f2ce
|
@ -37,12 +37,15 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
function understrap_theme_customize_register( $wp_customize ) {
|
function understrap_theme_customize_register( $wp_customize ) {
|
||||||
|
|
||||||
// Theme layout settings.
|
// Theme layout settings.
|
||||||
$wp_customize->add_section( 'understrap_theme_layout_options', array(
|
$wp_customize->add_section(
|
||||||
|
'understrap_theme_layout_options',
|
||||||
|
array(
|
||||||
'title' => __( 'Theme Layout Settings', 'understrap' ),
|
'title' => __( 'Theme Layout Settings', 'understrap' ),
|
||||||
'capability' => 'edit_theme_options',
|
'capability' => 'edit_theme_options',
|
||||||
'description' => __( 'Container width and sidebar defaults', 'understrap' ),
|
'description' => __( 'Container width and sidebar defaults', 'understrap' ),
|
||||||
'priority' => 160,
|
'priority' => 160,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select sanitization function
|
* Select sanitization function
|
||||||
|
@ -51,7 +54,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
* @param WP_Customize_Setting $setting Setting instance.
|
* @param WP_Customize_Setting $setting Setting instance.
|
||||||
* @return string Sanitized slug if it is a valid choice; otherwise, the setting default.
|
* @return string Sanitized slug if it is a valid choice; otherwise, the setting default.
|
||||||
*/
|
*/
|
||||||
function understrap_theme_slug_sanitize_select( $input, $setting ){
|
function understrap_theme_slug_sanitize_select( $input, $setting ) {
|
||||||
|
|
||||||
// Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only).
|
// Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only).
|
||||||
$input = sanitize_key( $input );
|
$input = sanitize_key( $input );
|
||||||
|
@ -64,17 +67,21 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_customize->add_setting( 'understrap_container_type', array(
|
$wp_customize->add_setting(
|
||||||
|
'understrap_container_type',
|
||||||
|
array(
|
||||||
'default' => 'container',
|
'default' => 'container',
|
||||||
'type' => 'theme_mod',
|
'type' => 'theme_mod',
|
||||||
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
|
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
|
||||||
'capability' => 'edit_theme_options',
|
'capability' => 'edit_theme_options',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$wp_customize->add_control(
|
$wp_customize->add_control(
|
||||||
new WP_Customize_Control(
|
new WP_Customize_Control(
|
||||||
$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',
|
||||||
|
@ -86,22 +93,29 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
),
|
),
|
||||||
'priority' => '10',
|
'priority' => '10',
|
||||||
)
|
)
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$wp_customize->add_setting( 'understrap_sidebar_position', array(
|
$wp_customize->add_setting(
|
||||||
|
'understrap_sidebar_position',
|
||||||
|
array(
|
||||||
'default' => 'right',
|
'default' => 'right',
|
||||||
'type' => 'theme_mod',
|
'type' => 'theme_mod',
|
||||||
'sanitize_callback' => 'sanitize_text_field',
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
'capability' => 'edit_theme_options',
|
'capability' => 'edit_theme_options',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$wp_customize->add_control(
|
$wp_customize->add_control(
|
||||||
new WP_Customize_Control(
|
new WP_Customize_Control(
|
||||||
$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' => __(
|
||||||
'understrap' ),
|
'Set sidebar\'s default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.',
|
||||||
|
'understrap'
|
||||||
|
),
|
||||||
'section' => 'understrap_theme_layout_options',
|
'section' => 'understrap_theme_layout_options',
|
||||||
'settings' => 'understrap_sidebar_position',
|
'settings' => 'understrap_sidebar_position',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
@ -114,7 +128,8 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
||||||
),
|
),
|
||||||
'priority' => '20',
|
'priority' => '20',
|
||||||
)
|
)
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} // endif function_exists( 'understrap_theme_customize_register' ).
|
} // endif function_exists( 'understrap_theme_customize_register' ).
|
||||||
add_action( 'customize_register', 'understrap_theme_customize_register' );
|
add_action( 'customize_register', 'understrap_theme_customize_register' );
|
||||||
|
@ -127,8 +142,12 @@ if ( ! function_exists( 'understrap_customize_preview_js' ) ) {
|
||||||
* Setup JS integration for live previewing.
|
* Setup JS integration for live previewing.
|
||||||
*/
|
*/
|
||||||
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(
|
||||||
array( 'customize-preview' ), '20130508', true
|
'understrap_customizer',
|
||||||
|
get_template_directory_uri() . '/js/customizer.js',
|
||||||
|
array( 'customize-preview' ),
|
||||||
|
'20130508',
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue