get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; //Categories dropdown class Britt_Category_Dropdown extends WP_Customize_Control { private $cats = false; public function __construct($manager, $id, $args = array(), $options = array()) { $this->cats = get_categories($options); parent::__construct( $manager, $id, $args ); } public function render_content() { if(!empty($this->cats)) { ?>
LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT.
LEARN MORE', 'britt' ) ) ); $wp_customize->add_control( 'loop_text', array( 'label' => __( 'Call to action area', 'britt' ), 'description' => __('This is the ribbon that displays on your homepage after the first two posts. HTML is supported. Leave empty to disable.', 'britt'), 'section' => 'britt_blog', 'type' => 'textarea', 'priority' => 13 ) ); $wp_customize->add_setting( 'exc_length', array( 'sanitize_callback' => 'absint', 'default' => '20' ) ); $wp_customize->add_control( 'exc_length', array( 'label' => __( 'Excerpt length', 'britt' ), 'section' => 'britt_blog', 'type' => 'text', 'priority' => 14 ) ); //___Colors___// $wp_customize->add_setting( 'primary_color', array( 'default' => '#D2AE90', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __('Primary color', 'britt'), 'section' => 'colors', 'priority' => 12 ) ) ); $wp_customize->add_setting( 'menu_bg', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'menu_bg', array( 'label' => __('Menu background', 'britt'), 'section' => 'colors', 'priority' => 13 ) ) ); $wp_customize->add_setting( 'menu_items', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'menu_items', array( 'label' => __('Menu items', 'britt'), 'section' => 'colors', 'priority' => 14 ) ) ); $wp_customize->add_setting( 'header_bg', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_bg', array( 'label' => __('Header background', 'britt'), 'section' => 'colors', 'priority' => 14 ) ) ); $wp_customize->add_setting( 'site_title', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'site_title', array( 'label' => __('Site title', 'britt'), 'section' => 'colors', 'priority' => 15 ) ) ); $wp_customize->add_setting( 'site_description', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'site_description', array( 'label' => __('Site description', 'britt'), 'section' => 'colors', 'priority' => 16 ) ) ); $wp_customize->add_setting( 'title_panels', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'title_panels', array( 'label' => __('Title panels', 'britt'), 'section' => 'colors', 'priority' => 17 ) ) ); $wp_customize->add_setting( 'body_text_color', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'body_text_color', array( 'label' => __('Body text', 'britt'), 'section' => 'colors', 'priority' => 18 ) ) ); $wp_customize->add_setting( 'footer_bg', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'footer_bg', array( 'label' => __('Footer background', 'britt'), 'section' => 'colors', 'priority' => 19 ) ) ); //___Fonts___// $wp_customize->add_section( 'britt_fonts', array( 'title' => __('Fonts', 'britt'), 'priority' => 15, 'description' => __('For help selecting fonts see the documentation. The font list is here: google.com/fonts', 'britt'), ) ); //Body fonts $wp_customize->add_setting( 'body_fonts', array( 'default' => '//fonts.googleapis.com/css?family=Merriweather:300,300italic,700,700italic', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'body_fonts', array( 'label' => __( 'Body font', 'britt' ), 'section' => 'britt_fonts', 'type' => 'text', 'priority' => 11 ) ); //Body fonts family $wp_customize->add_setting( 'body_font_family', array( 'sanitize_callback' => 'britt_sanitize_text', 'default' => 'font-family: \'Merriweather\', serif;', ) ); $wp_customize->add_control( 'body_font_family', array( 'label' => __( 'Body font family', 'britt' ), 'section' => 'britt_fonts', 'type' => 'text', 'priority' => 12 ) ); //Headings fonts $wp_customize->add_setting( 'headings_fonts', array( 'default' => '//fonts.googleapis.com/css?family=Playfair+Display:400,400italic,700,700italic', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'headings_fonts', array( 'label' => __( 'Headings font', 'britt' ), 'section' => 'britt_fonts', 'type' => 'text', 'priority' => 14 ) ); //Headings fonts family $wp_customize->add_setting( 'headings_font_family', array( 'sanitize_callback' => 'britt_sanitize_text', 'default' => 'font-family: \'Playfair Display\', serif;', ) ); $wp_customize->add_control( 'headings_font_family', array( 'label' => __( 'Headings font family', 'britt' ), 'section' => 'britt_fonts', 'type' => 'text', 'priority' => 15 ) ); // Site title $wp_customize->add_setting( 'site_title_size', array( 'sanitize_callback' => 'absint', 'default' => '78', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'site_title_size', array( 'type' => 'number', 'priority' => 17, 'section' => 'britt_fonts', 'label' => __('Site title', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 80, 'step' => 1, ), ) ); // Site description $wp_customize->add_setting( 'site_desc_size', array( 'sanitize_callback' => 'absint', 'default' => '16', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'site_desc_size', array( 'type' => 'number', 'priority' => 17, 'section' => 'britt_fonts', 'label' => __('Site description', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 50, 'step' => 1, ), ) ); //H1 size $wp_customize->add_setting( 'h1_size', array( 'sanitize_callback' => 'absint', 'default' => '36', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h1_size', array( 'type' => 'number', 'priority' => 17, 'section' => 'britt_fonts', 'label' => __('H1 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //H2 size $wp_customize->add_setting( 'h2_size', array( 'sanitize_callback' => 'absint', 'default' => '30', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h2_size', array( 'type' => 'number', 'priority' => 18, 'section' => 'britt_fonts', 'label' => __('H2 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //H3 size $wp_customize->add_setting( 'h3_size', array( 'sanitize_callback' => 'absint', 'default' => '24', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h3_size', array( 'type' => 'number', 'priority' => 19, 'section' => 'britt_fonts', 'label' => __('H3 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //H4 size $wp_customize->add_setting( 'h4_size', array( 'sanitize_callback' => 'absint', 'default' => '18', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h4_size', array( 'type' => 'number', 'priority' => 20, 'section' => 'britt_fonts', 'label' => __('H4 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //H5 size $wp_customize->add_setting( 'h5_size', array( 'sanitize_callback' => 'absint', 'default' => '14', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h5_size', array( 'type' => 'number', 'priority' => 21, 'section' => 'britt_fonts', 'label' => __('H5 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //H6 size $wp_customize->add_setting( 'h6_size', array( 'sanitize_callback' => 'absint', 'default' => '12', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'h6_size', array( 'type' => 'number', 'priority' => 22, 'section' => 'britt_fonts', 'label' => __('H6 font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 60, 'step' => 1, ), ) ); //Body $wp_customize->add_setting( 'body_size', array( 'sanitize_callback' => 'absint', 'default' => '16', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'body_size', array( 'type' => 'number', 'priority' => 23, 'section' => 'britt_fonts', 'label' => __('Body font size', 'britt'), 'input_attrs' => array( 'min' => 10, 'max' => 24, 'step' => 1, ), ) ); } add_action( 'customize_register', 'britt_customize_register' ); /** * Sanitize */ //Featured images function britt_sanitize_single_images( $input ) { if ( in_array( $input, array( 'in-post', 'above-post', 'none' ), true ) ) { return $input; } } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function britt_customize_preview_js() { wp_enqueue_script( 'britt_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20160509', true ); } add_action( 'customize_preview_init', 'britt_customize_preview_js' ); //Checkboxes function britt_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } //Integers function britt_sanitize_int( $input ) { if( is_numeric( $input ) ) { return intval( $input ); } } //Text function britt_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } //Sticky widgets function britt_sanitize_sticky_widgets( $input ) { if ( in_array( $input, array( 'on', 'off' ), true ) ) { return $input; } }