get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section('background_image')->title = __( 'Background', 'anyonepage' ); $wp_customize->get_section('header_image')->title = __( 'Header', 'anyonepage' ); $wp_customize->add_setting( 'header_title', array( 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'header_title', array( 'label' => __( "Header Title", 'anyonepage' ), 'section' => 'header_image', 'type' => 'text', 'priority' => 1, ) ); $wp_customize->add_setting( 'header_title_color', array( 'default' => '#fff', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_title_color', array( 'label' => __( 'Header Title Color', 'anyonepage' ), 'section' => 'header_image', 'priority' => 1, 'settings' => 'header_title_color', ) ) ); $wp_customize->add_setting( 'header_tagline', array( 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'header_tagline', array( 'label' => __( "Header Tagline", 'anyonepage' ), 'section' => 'header_image', 'type' => 'text', 'priority' => 1, ) ); $wp_customize->add_setting( 'header_tagline_color', array( 'default' => '#fff', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_tagline_color', array( 'label' => __( 'Header Tagline Color', 'anyonepage' ), 'section' => 'header_image', 'priority' => 1, 'settings' => 'header_tagline_color', ) ) ); $wp_customize->add_setting( 'header_bg_color', array( 'default' => '#333', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_bg_color', array( 'label' => __( 'Header Background Color', 'anyonepage' ), 'section' => 'header_image', 'priority' => 1, 'settings' => 'header_bg_color', ) ) ); $wp_customize->add_control( 'header_textcolor', array( 'label' => __( 'Header Text Color', 'anyonepage' ), 'section' => 'head_colors', ) ); $wp_customize->add_setting( 'header_background_color', array( 'default' => '#00adcf', // steelblue 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage' ) ); // Show Sitename in Menubar Control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'show_sitename_in_menubar', array( 'label' => __( 'Show sitename in menu bar?', 'anyonepage' ), 'type' => 'checkbox', 'section' => 'title_tagline', ) ) ); /* ///////////////// SIDEBAR LAYOUT ////////////////// */ /* * Select Sidebar Layout */ // Add Sidebar Layout Section $wp_customize->add_section( 'anyonepage-options', array( 'title' => __( 'Theme Options', 'anyonepage' ), 'capability' => 'edit_theme_options', 'description' => __( 'Change the default display options for the theme.', 'anyonepage' ), ) ); // Sidebar Layout setting $wp_customize->add_setting( 'layout_setting', array( 'default' => 'sidebar-right', 'type' => 'theme_mod', 'sanitize_callback' => 'anyonepage_sanitize_layout', 'transport' => 'postMessage' ) ); // Sidebar Layout Control $wp_customize->add_control( 'layout_control', array( 'settings' => 'layout_setting', 'type' => 'radio', 'label' => __( 'Sidebar position', 'anyonepage' ), 'choices' => array( 'no-sidebar' => __( 'No sidebar', 'anyonepage' ), 'sidebar-right' => __( 'Sidebar right', 'anyonepage' ), 'sidebar-left' => __( 'Sidebar left', 'anyonepage' ), ), 'section' => 'sidebar_settings' ) ); /** * Front Page sections * * @since anyonepage 2.1.2 * * @param $page_names array */ $page_names = array( 'services', 'clients', 'about', 'contact' ); // Create a setting and control for each of the sections available in the theme. for ( $i = 0; $i < count( $page_names ); $i++ ) { $wp_customize->add_setting( 'panel_' . $page_names[$i], array( 'default' => false, 'sanitize_callback' => 'absint', // 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'panel_' . $page_names[$i], array( /* translators: %s is the front page section name */ 'label' => sprintf( __( '%s Page Content', 'anyonepage' ), ucwords( $page_names[$i] ) ), 'description' => ( 0 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'anyonepage' ) ), 'section' => 'static_front_page', 'type' => 'dropdown-pages', 'allow_addition' => true, 'active_callback' => 'anyonepage_is_static_front_page', ) ); // $wp_customize->selective_refresh->add_partial( 'panel_' . $page_names[$i], array( // 'selector' => '#' . $page_names[$i], // 'render_callback' => 'anyonepage_front_page_section', // 'container_inclusive' => true, // ) ); } } add_action( 'customize_register', 'anyonepage_customize_register' ); /** * Return whether we're previewing the front page and it's a static page. */ function anyonepage_is_static_front_page() { return ( is_front_page() && ! is_home() ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function anyonepage_customize_preview_js() { wp_enqueue_script( 'anyonepage_customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20160507', true ); } add_action( 'customize_preview_init', 'anyonepage_customize_preview_js' ); /* * Sanitize layout options */ function anyonepage_sanitize_layout ( $value ) { if ( !in_array( $value, array( 'no-sidebar', 'sidebar-right', 'sidebar-left' ) ) ) { $value = 'no-sidebar'; } return $value; } /** * Checkbox sanitization callback * @link https://github.com/WPTRT/code-examples/blob/master/customizer/sanitization-callbacks.php * * Sanitization callback for 'checkbox' type controls. This callback sanitizes `$checked` * as a boolean value, either TRUE or FALSE. * * @param bool $checked Whether the checkbox is checked. * @return bool Whether the checkbox is checked. */ function anyonepage_sanitize_checkbox( $checked ) { // Boolean check return ( ( isset( $checked ) && true == $checked ) ? true : false ); } if(! function_exists('anyonepage_custom_styles' ) ): /** * Set the header background color */ function anyonepage_custom_styles(){ ?>