code format and customizer grid post small fix

This commit is contained in:
Stef Kariotidis 2016-11-21 19:47:45 +02:00
parent 0fab781b1c
commit 1d01962d1b
1 changed files with 31 additions and 32 deletions

View File

@ -29,7 +29,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
/** /**
* Register individual settings through customizer's API. * Register individual settings through customizer's API.
* *
* @param object $wp_customize Customizer reference. * @param WP_Customize_Manager $wp_customize Customizer reference.
*/ */
function understrap_theme_customize_register( $wp_customize ) { function understrap_theme_customize_register( $wp_customize ) {
@ -122,7 +122,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
'understrap_sidebar_position', array( 'understrap_sidebar_position', array(
'label' => __( 'Sidebar Positioning', 'understrap' ), 'label' => __( 'Sidebar Positioning', 'understrap' ),
'description' => __( "Set sidebar's position. Can either be: right, left, both or none", 'description' => __( "Set sidebar's position. Can either be: right, left, both or none",
'understrap' ), 'understrap' ),
'section' => 'understrap_theme_layout_options', 'section' => 'understrap_theme_layout_options',
'settings' => 'understrap_sidebar_position', 'settings' => 'understrap_sidebar_position',
'type' => 'select', 'type' => 'select',
@ -172,40 +172,39 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
return 'grid' == get_theme_mod( 'understrap_posts_index_style' ); return 'grid' == get_theme_mod( 'understrap_posts_index_style' );
} }
if ( is_grid_enabled() ) { // How many columns to use each grid post.
// How many columns to use each grid post. $wp_customize->add_setting( 'understrap_grid_post_columns', array(
$wp_customize->add_setting( 'understrap_grid_post_columns', array( 'default' => '6',
'default' => '6', 'type' => 'theme_mod',
'type' => 'theme_mod', 'capability' => 'edit_theme_options',
'capability' => 'edit_theme_options', 'transport' => 'refresh',
'transport' => 'refresh', ) );
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'understrap_grid_post_columns', array(
'label' => __( 'Grid Post Columns', 'understrap' ),
'description' => __( 'Choose how many columns to use in grid posts', 'understrap' ),
'section' => 'understrap_theme_layout_options',
'settings' => 'understrap_grid_post_columns',
'type' => 'select',
'choices' => array(
'6' => '6',
'4' => '4',
'3' => '3',
'2' => '2',
'1' => '1',
),
'default' => 6,
'priority' => '30',
'transport' => 'refresh',
)
) ); ) );
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'understrap_grid_post_columns', array(
'label' => __( 'Grid Post Columns', 'understrap' ),
'description' => __( 'Choose how many columns to use in grid posts', 'understrap' ),
'section' => 'understrap_theme_layout_options',
'settings' => 'understrap_grid_post_columns',
'type' => 'select',
'choices' => array(
'6' => '6',
'4' => '4',
'3' => '3',
'2' => '2',
'1' => '1',
),
'default' => 6,
'priority' => '30',
'transport' => 'refresh',
)
) );
}
// hook to auto-hide/show depending the understrap_posts_index_style option. // hook to auto-hide/show depending the understrap_posts_index_style option.
$wp_customize->get_control( 'understrap_grid_post_columns' )->active_callback = 'is_grid_enabled'; $wp_customize->get_control( 'understrap_grid_post_columns' )->active_callback = 'is_grid_enabled';
} }
} // 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' );