get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // Color options $wp_customize->add_section( 'atlantic_color_options', array( 'title' => __( 'Colors', 'atlantic' ), 'priority' => 300, 'capability' => 'edit_theme_options', 'description' => __('Change color options here.', 'atlantic'), ) ); $wp_customize->add_setting( 'atlantic_bg_color', array( 'default' => '#ffffff', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_setting( 'atlantic_heading_color', array( 'default' => '#404040', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_setting( 'atlantic_navigation_color', array( 'default' => '#404040', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_setting( 'atlantic_font_color', array( 'default' => '#404040', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_setting( 'atlantic_link_color', array( 'default' => '#404040', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'atlantic_bg_color_control', array( 'label' => __( 'Background Color', 'atlantic' ), 'section' => 'atlantic_color_options', 'settings' => 'atlantic_bg_color', 'priority' => 10, ) )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'atlantic_heading_color_control', array( 'label' => __( 'Headings Color', 'atlantic' ), 'section' => 'atlantic_color_options', 'settings' => 'atlantic_heading_color', 'priority' => 20, ) )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'atlantic_navigation_color_control', array( 'label' => __( 'Navigation Color', 'atlantic' ), 'section' => 'atlantic_color_options', 'settings' => 'atlantic_navigation_color', 'priority' => 20, ) )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'atlantic_font_color_control', array( 'label' => __( 'Font Color', 'atlantic' ), 'section' => 'atlantic_color_options', 'settings' => 'atlantic_font_color', 'priority' => 30, ) )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'atlantic_link_color_control', array( 'label' => __( 'Links Color', 'atlantic' ), 'section' => 'atlantic_color_options', 'settings' => 'atlantic_link_color', 'priority' => 20, ) )); // Width options $wp_customize->add_section( 'atlantic_width_options', array( 'title' => __( 'Widths', 'atlantic' ), 'priority' => 310, 'capability' => 'edit_theme_options', 'description' => __('Change width options here.', 'atlantic'), ) ); $wp_customize->add_setting( 'atlantic_width', array( 'default' => '1280', 'transport' => 'postMessage', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_setting( 'atlantic_content_width', array( 'default' => '640', 'transport' => 'postMessage', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'atlantic_width_control', array( 'label' => __( 'Website Width', 'atlantic' ), 'section' => 'atlantic_width_options', 'settings' => 'atlantic_width', 'type' => 'number', 'priority' => 10, ) )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'atlantic_content_width_control', array( 'label' => __( 'Content Width', 'atlantic' ), 'section' => 'atlantic_width_options', 'settings' => 'atlantic_content_width', 'type' => 'number', 'priority' => 20, ) )); // Google fonts if (get_transient('atlantic_google_fonts')) : $google_fonts = get_transient('atlantic_google_fonts'); else : $google_api = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=AIzaSyCS29WfOgw3EUqe-VPzh0WLAsMLZ67mqS4'; $font_content = wp_remote_get( $google_api, array('sslverify' => false) ); $google_fonts = json_decode($font_content['body']); set_transient( 'atlantic_google_fonts', $google_fonts, WEEK_IN_SECONDS ); endif; foreach ($google_fonts->items as $google_font) : $font_choices[$google_font->family] = $google_font->family; endforeach; $wp_customize->add_section( 'atlantic_font_options', array( 'title' => __( 'Fonts', 'atlantic' ), 'priority' => 330, 'capability' => 'edit_theme_options', 'description' => __('Change font options here.', 'atlantic'), ) ); $wp_customize->add_setting( 'atlantic_font', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_setting( 'atlantic_heading_font', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'atlantic_font_control', array( 'label' => __( 'Website Font', 'atlantic' ), 'section' => 'atlantic_font_options', 'settings' => 'atlantic_font', 'type' => 'select', 'choices' => $font_choices, 'priority' => 10, ) )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'atlantic_heading_font_control', array( 'label' => __( 'Heading Font', 'atlantic' ), 'section' => 'atlantic_font_options', 'settings' => 'atlantic_heading_font', 'type' => 'select', 'choices' => $font_choices, 'priority' => 20, ) )); } add_action( 'customize_register', 'atlantic_customize_register' ); function atlantic_dynamic_css() { ?>