get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // Setting - Add Logo $wp_customize->add_setting( 'amidstsky_logo', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); // Control - Add Logo $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'amidstsky_logo', array( 'label' => __( 'Site Logo (replaces text)', 'amidstsky' ), 'section' => 'title_tagline', 'settings' => 'amidstsky_logo', ) ) ); // Setting - Site Main Background Color $wp_customize->add_setting( 'amidstsky_site_bg', array( 'default' => '#ffffff', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Site Main Background Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_site_bg', array ( 'label' => __( 'Site Content Background', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_site_bg', 'priority' => 1 ) ) ); // Setting - Accent Color $wp_customize->add_setting( 'amidstsky_accent_color', array( 'default' => '#D32F2F', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Accent Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_accent_color', array ( 'label' => __( 'Accent Color', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_accent_color', 'priority' => 1 ) ) ); // Setting - Entry Title Link Color $wp_customize->add_setting( 'amidstsky_entry_title_link', array( 'default' => '#ffffff', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Entry Title Link Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_entry_title_link', array ( 'label' => __( 'Entry Title Link', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_entry_title_link', 'priority' => 1 ) ) ); // Setting - Sticky Post Background Color $wp_customize->add_setting( 'amidstsky_sticky_post_bg', array( 'default' => '#ccc', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Sticky Post Background Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_sticky_post_bg', array ( 'label' => __( 'Sticky Post Background', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_sticky_post_bg', 'priority' => 1 ) ) ); // Setting - Text Color $wp_customize->add_setting( 'amidstsky_text_color', array( 'default' => '#4b4b4b', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Text Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_text_color', array ( 'label' => __( 'Text Color', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_text_color', 'priority' => 1 ) ) ); // Setting - Entry Content Color $wp_customize->add_setting( 'amidstsky_entry_content', array( 'default' => '#000000', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Entry Content Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_entry_content', array ( 'label' => __( 'Entry Content', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_entry_content', 'priority' => 1 ) ) ); // Setting - Menu Link Color $wp_customize->add_setting( 'amidstsky_menu_link', array( 'default' => '#4b4b4b', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Menu Link Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_menu_link', array ( 'label' => __( 'Navigation Links', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_menu_link', 'priority' => 1 ) ) ); // Setting - Menu Hover Background Color $wp_customize->add_setting( 'amidstsky_menu_hover_bg', array( 'default' => '#eeeeee', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Accent Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_menu_hover_bg', array ( 'label' => __( 'Menu Item Hover Background', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_menu_hover_bg', 'priority' => 1 ) ) ); // Setting - Entry Content Color $wp_customize->add_setting( 'amidstsky_submenu_bg', array( 'default' => '#ffffff', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Accent Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_submenu_bg', array ( 'label' => __( 'Sub Menu Background', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_submenu_bg', 'priority' => 1 ) ) ); // Setting - Entry Content Color $wp_customize->add_setting( 'amidstsky_footer_bg', array( 'default' => '#eeeeee', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Control - Accent Color $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'amidstsky_footer_bg', array ( 'label' => __( 'Site Footer Background', 'amidstsky' ), 'section' => 'colors', 'settings' => 'amidstsky_footer_bg', 'priority' => 10 ) ) ); /*------------------------------------------ # Layout ------------------------------------------*/ // Section $wp_customize->add_section( 'amidstsky_layout', array ( 'title' => __( 'Layout', 'amidstsky' ), 'priority' => 400 ) ); $wp_customize->add_setting( 'amidstsky_site_layout', array( 'default' => true, 'transport' => 'refresh', 'sanitize_callback' => 'amidstsky_sanitize', // function in extras.php ) ); $wp_customize->add_control( 'amidstsky_site_layout', array( 'section' => 'amidstsky_layout', 'label' => __( 'Boxed Layout', 'amidstsky' ), 'setting' => 'amidstsky_site_layout', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'amidstsky_blog_layout', array( 'default' => 'content_sidebar', 'transport' => 'refresh', 'sanitize_callback' => 'amidstsky_sanitize' ) ); $wp_customize->add_control( 'amidstsky_blog_layout', array( 'section' => 'amidstsky_layout', 'label' => __( 'Choose Layout', 'amidstsky' ), 'setting' => 'amidstsky_blog_layout', 'type' => 'radio', 'choices' => $layout = array( 'content_sidebar' => __( 'Content-Sidebar', 'amidstsky' ), 'sidebar_content' => __( 'Sidebar-Content', 'amidstsky' ), 'no_sidebar' => __( 'No Sidebar', 'amidstsky' ), ) ) ); /*------------------------------------------ # Google Fonts ------------------------------------------*/ // Section $wp_customize->add_section( 'amidstsky_fonts', array ( 'title' => __( 'Google Fonts', 'amidstsky' ), 'priority' => 400 ) ); $wp_customize->add_setting( 'amidstsky_google_fonts', array( 'default' => true, 'transport' => 'refresh', 'sanitize_callback' => 'amidstsky_sanitize' ) ); $wp_customize->add_control( 'amidstsky_google_fonts', array( 'section' => 'amidstsky_fonts', 'label' => __( 'Use Google Fonts', 'amidstsky' ), 'setting' => 'amidstsky_google_fonts', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'amidstsky_body_font', array( 'default' => 'Lora', 'transport' => 'refresh', 'sanitize_callback' => 'amidstsky_sanitize' ) ); $wp_customize->add_control( 'amidstsky_body_font', array( 'section' => 'amidstsky_fonts', 'label' => __( 'Choose Body Font', 'amidstsky' ), 'setting' => 'amidstsky_body_font', 'type' => 'select', 'choices' => $fonts = array( 'Open Sans' => 'Open Sans', 'Roboto' => 'Roboto', 'Lato' => 'Lato', 'Lora' => 'Lora', 'PT Serif' => 'PT Serif', 'Droid Serif' => 'Droid Serif', 'Cardo' => 'Cardo', 'Crimson Text' => 'Crimson Text', ) ) ); $wp_customize->add_setting( 'amidstsky_heading_font', array( 'default' => 'Montserrat', 'transport' => 'refresh', 'sanitize_callback' => 'amidstsky_sanitize' ) ); $wp_customize->add_control( 'amidstsky_heading_font', array( 'section' => 'amidstsky_fonts', 'label' => __( 'Choose Headings Font', 'amidstsky' ), 'setting' => 'amidstsky_heading_font', 'type' => 'select', 'choices' => $fonts = array( 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Open Sans' => 'Open Sans', 'Roboto' => 'Roboto', 'Lato' => 'Lato', 'Lora' => 'Lora', 'PT Sans' => 'PT Sans', 'Droid Sans' => 'Droid Sans', ) ) ); /*------------------------------------------ # Theme Options ------------------------------------------*/ // Section $wp_customize->add_section( 'amidstsky_theme_options', array ( 'title' => __( 'Theme Options', 'amidstsky' ), 'description' => __('More options.', 'amidstsky' ), 'priority' => 500 ) ); // Setting - Copyright Message $wp_customize->add_setting( 'amidstsky_footer_message', array( 'default' => 'Copyright 2015 All rights reserved.', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); // Control - Copyright Message $wp_customize->add_control( 'amidstsky_footer_message', array( 'section' => 'amidstsky_theme_options', 'label' => __( 'Footer Message', 'amidstsky' ), 'type' => 'text' ) ); } add_action( 'customize_register', 'amidstsky_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function amidstsky_customize_preview() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'amidstsky_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'jquery', 'customize-preview' ), '20150816', true ); } add_action( 'customize_preview_init', 'amidstsky_customize_preview' ); function amidstsky_customize_css() { ?>