add_section( 'basically_bootstrap_4_header' , array( 'title' => __( 'Header', 'basically-bootstrap-4' ), 'priority' => 20, ) ); $wp_customize->add_setting( 'basically_bootstrap_4_header_width' , array( 'default' => 'page', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_header_width', array( 'label' => __( 'Header Background Width', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'page' => __( 'Page content width', 'basically-bootstrap-4' ), 'full' => __( 'Full width', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_header', 'settings' => 'basically_bootstrap_4_header_width', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_header_style' , array( 'default' => 'left', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_header_style', array( 'label' => __( 'Header Style', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'left' => __( 'Site branding left and menu right', 'basically-bootstrap-4' ), 'right' => __( 'Site branding right and menu left', 'basically-bootstrap-4' ), 'middle' => __( 'Site branding and menu middle', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_header', 'settings' => 'basically_bootstrap_4_header_style', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_header_site_branding' , array( 'default' => 'small', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_header_site_branding', array( 'label' => __( 'Size of site branding (header style left or right)', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'small' => __( 'Small', 'basically-bootstrap-4' ), 'medium' => __( 'Medium', 'basically-bootstrap-4' ), 'large' => __( 'Large', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_header', 'settings' => 'basically_bootstrap_4_header_site_branding', ) ) ); /* Customize Backgrounds */ $wp_customize->add_section( 'basically_bootstrap_4_colors' , array( 'title' => __( 'Colors/Background images', 'basically-bootstrap-4' ), 'priority' => 30, ) ); $wp_customize->add_setting( 'basically_bootstrap_4_background_color' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'basically_bootstrap_4_background_color', array( 'label' => __( 'Background Color', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_background_color', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_background_image', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_image' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'basically_bootstrap_4_background_image', array( 'label' => __( 'Background Image', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_background_image', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_header_background_color' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'basically_bootstrap_4_header_background_color', array( 'label' => __( 'Header Background Color', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_header_background_color', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_header_background_image', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_image' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'basically_bootstrap_4_header_background_image', array( 'label' => __( 'Header Background Image', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_header_background_image', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_footer_background_color' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'basically_bootstrap_4_footer_background_color', array( 'label' => __( 'Footer Background Color', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_footer_background_color', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_footer_background_image', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_image' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'basically_bootstrap_4_footer_background_image', array( 'label' => __( 'Footer Background Image', 'basically-bootstrap-4' ), 'section' => 'basically_bootstrap_4_colors', 'settings' => 'basically_bootstrap_4_footer_background_image', ) ) ); /* Customize Blog */ $wp_customize->add_section( 'basically_bootstrap_4_blog' , array( 'title' => __( 'Blog', 'basically-bootstrap-4' ), 'priority' => 40, ) ); $wp_customize->add_setting( 'basically_bootstrap_4_blog_sidebar' , array( 'default' => 'left', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_blog_sidebar', array( 'label' => __( 'Blog Sidebar', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'left' => __( 'Sidebar left', 'basically-bootstrap-4' ), 'right' => __( 'Sidebar right', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_blog', 'settings' => 'basically_bootstrap_4_blog_sidebar', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_blog_post_length' , array( 'default' => 'summary', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_blog_post_length', array( 'label' => __( 'Blog Post/Search Result Length', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'summary' => __( 'Summary', 'basically-bootstrap-4' ), 'full' => __( 'Full Text', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_blog', 'settings' => 'basically_bootstrap_4_blog_post_length', ) ) ); /* Customize Footer */ $wp_customize->add_section( 'basically_bootstrap_4_footer' , array( 'title' => __( 'Footer', 'basically-bootstrap-4' ), 'priority' => 50, ) ); $wp_customize->add_setting( 'basically_bootstrap_4_footer_width' , array( 'default' => 'page', 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_footer_width', array( 'label' => __( 'Footer Background Width', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 'page' => __( 'Page content width', 'basically-bootstrap-4' ), 'full' => __( 'Full width', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_footer', 'settings' => 'basically_bootstrap_4_footer_width', ) ) ); $wp_customize->add_setting( 'basically_bootstrap_4_footer_number_columns' , array( 'default' => 4, 'transport' => 'refresh', 'sanitize_callback' => 'basically_bootstrap_4_sanitize_select' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'basically_bootstrap_4_footer_number_columns', array( 'label' => __( 'Number of Columns', 'basically-bootstrap-4' ), 'type' => 'radio', 'choices' => array( 2 => __( 'Two', 'basically-bootstrap-4' ), 3 => __( 'Three', 'basically-bootstrap-4' ), 4 => __( 'Four', 'basically-bootstrap-4' ), ), 'section' => 'basically_bootstrap_4_footer', 'settings' => 'basically_bootstrap_4_footer_number_columns', ) ) ); } add_action( 'customize_register', 'basically_bootstrap_4_customize_register' ); /* Sanitization Callbacks */ /* Selects */ function basically_bootstrap_4_sanitize_select( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } /* Images */ function basically_bootstrap_4_sanitize_image( $input, $default = '' ) { if ($input == '') { return $input; } $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon', ); $file = wp_check_filetype( $input, $mimes ); return ( $file['ext'] ? $input : $default ); } ?>