get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title', 'render_callback' => 'beetan_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'beetan_customize_partial_blogdescription', ) ); $wp_customize->selective_refresh->add_partial( 'custom_logo', array( 'selector' => '.site-branding', 'render_callback' => 'the_custom_logo', 'container_inclusive' => true, ) ); } /* * Start Header Settings */ $wp_customize->add_section( 'header_options', array( 'title' => esc_html__( 'Header Options', 'beetan' ), 'priority' => 37, ) ); $wp_customize->add_setting( 'sticky_header', array( 'default' => false, 'sanitize_callback' => 'beetan_sanitize_boolean', ) ); $wp_customize->add_control( new Beetan_Customize_Toggle_Control( $wp_customize, 'sticky_header', array( 'label' => esc_html__( 'Sticky Header', 'beetan' ), 'description' => esc_html__( 'Set the header to sticky, so that it follows as users scroll.', 'beetan' ), 'section' => 'header_options', ) ) ); /* Header Variation Control */ $wp_customize->add_setting( 'header_variation', array( 'default' => '3', 'sanitize_callback' => 'sanitize_key', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'header_variation', array( 'label' => esc_html__( 'Header Styles', 'beetan' ), 'section' => 'header_options', 'settings' => 'header_variation', 'choices' => array( '1' => array( 'label' => esc_html__( 'Header Style 1', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/header-1.svg' ) ), '2' => array( 'label' => esc_html__( 'Header Style 2', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/header-2.svg' ) ), '3' => array( 'label' => esc_html__( 'Header Style 3', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/header-3.svg' ) ), '4' => array( 'label' => esc_html__( 'Header Style 4', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/header-4.svg' ) ) ) ) ) ); /* * End Header Settings */ /* * Start Footer Settings */ $wp_customize->add_section( 'footer_options', array( 'title' => esc_html__( 'Footer Options', 'beetan' ), 'priority' => 37, ) ); $wp_customize->add_setting( 'copyright_text', array( 'sanitize_callback' => 'wp_kses_post', 'default' => sprintf( /* translators: %s: StorePress. */ wp_kses_post( __( 'Copyright © %1$s %2$s. All Rights Reserved.', 'beetan' ) ), date( 'Y' ), esc_html__( get_option( 'blogname' ) ) ), ) ); $wp_customize->add_control( new Beetan_Customize_TinyMCE_Control( $wp_customize, 'copyright_text', array( 'label' => esc_html__( 'Copyright Text', 'beetan' ), 'section' => 'footer_options' ) ) ); /* * End Footer Settings */ /* * Start Layout Settings */ $wp_customize->add_section( 'layout_options', array( 'title' => esc_html__( 'Layout Options', 'beetan' ), 'priority' => 37, ) ); $wp_customize->add_setting( 'site_container_width', array( 'default' => 1120, "transport" => "postMessage", 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new Beetan_Customize_Number_Control( $wp_customize, 'site_container_width', array( 'label' => esc_html__( 'Site Container Width', 'beetan' ), 'description' => esc_html__( 'Set site container width in PX.', 'beetan' ), 'section' => 'layout_options', 'input_attrs' => array( 'min' => 768, 'max' => 1920, 'step' => 1, ) ) ) ); /* * End Layout Settings */ /* * Start Sidebar Settings */ $wp_customize->add_section( 'sidebar_settings_section', array( 'title' => esc_html( 'Sidebar Options', 'beetan' ), 'priority' => 37, ) ); /* Page Sidebar Control */ $wp_customize->add_setting( 'page_sidebar_position', array( 'sanitize_callback' => 'sanitize_key', 'default' => 'no_sidebar', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'page_sidebar_position', array( 'label' => esc_html__( 'Page', 'beetan' ), 'section' => 'sidebar_settings_section', 'settings' => 'page_sidebar_position', 'choices' => array( 'no_sidebar' => array( 'label' => esc_html__( 'No Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/full-width.svg' ) ), 'left_sidebar' => array( 'label' => esc_html__( 'Left Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/left-sidebar.svg' ) ), 'right_sidebar' => array( 'label' => esc_html__( 'Right Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/right-sidebar.svg' ) ) ) ) ) ); /* Single Post Sidebar Control */ $wp_customize->add_setting( 'post_sidebar_position', array( 'sanitize_callback' => 'beetan_sanitize_select', 'default' => 'no_sidebar', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'post_sidebar_position', array( 'label' => esc_html( 'Single Post', 'beetan' ), 'section' => 'sidebar_settings_section', 'settings' => 'post_sidebar_position', 'choices' => array( 'no_sidebar' => array( 'label' => esc_html__( 'No Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/full-width.svg' ) ), 'left_sidebar' => array( 'label' => esc_html__( 'Left Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/left-sidebar.svg' ) ), 'right_sidebar' => array( 'label' => esc_html__( 'Right Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/right-sidebar.svg' ) ) ) ) ) ); /* Archive Sidebar Control */ $wp_customize->add_setting( 'archive_post_sidebar_position', array( 'sanitize_callback' => 'beetan_sanitize_select', 'default' => 'no_sidebar', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'archive_post_sidebar_position', array( 'label' => esc_html( 'Archives', 'beetan' ), 'section' => 'sidebar_settings_section', 'settings' => 'archive_post_sidebar_position', 'choices' => array( 'no_sidebar' => array( 'label' => esc_html__( 'No Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/full-width.svg' ) ), 'left_sidebar' => array( 'label' => esc_html__( 'Left Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/left-sidebar.svg' ) ), 'right_sidebar' => array( 'label' => esc_html__( 'Right Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/right-sidebar.svg' ) ) ) ) ) ); if ( beetan_is_woocommerce_active() ) { /* WooCommerce Sidebar Control */ $wp_customize->add_setting( 'archive_product_sidebar_position', array( 'sanitize_callback' => 'beetan_sanitize_select', 'default' => 'no_sidebar', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'archive_product_sidebar_position', array( 'label' => esc_html( 'WooCommerce', 'beetan' ), 'section' => 'sidebar_settings_section', 'settings' => 'archive_product_sidebar_position', 'choices' => array( 'no_sidebar' => array( 'label' => esc_html__( 'No Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/full-width.svg' ) ), 'left_sidebar' => array( 'label' => esc_html__( 'Left Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/left-sidebar.svg' ) ), 'right_sidebar' => array( 'label' => esc_html__( 'Right Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/right-sidebar.svg' ) ) ) ) ) ); /* Single Product Sidebar Control */ $wp_customize->add_setting( 'product_sidebar_position', array( 'sanitize_callback' => 'beetan_sanitize_select', 'default' => 'no_sidebar', ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'product_sidebar_position', array( 'label' => esc_html( 'Single Product', 'beetan' ), 'section' => 'sidebar_settings_section', 'settings' => 'product_sidebar_position', 'choices' => array( 'no_sidebar' => array( 'label' => esc_html__( 'No Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/full-width.svg' ) ), 'left_sidebar' => array( 'label' => esc_html__( 'Left Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/left-sidebar.svg' ) ), 'right_sidebar' => array( 'label' => esc_html__( 'Right Sidebar', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/right-sidebar.svg' ) ) ) ) ) ); } /* * End Sidebar Settings */ /* * Start Blog Settings */ $wp_customize->add_section( 'blog_options', array( 'title' => esc_html( 'Blog Options', 'beetan' ), 'priority' => 37, ) ); /* Blog Layout Control */ $wp_customize->add_setting( 'blog_layout', array( 'default' => 'default', 'sanitize_callback' => 'sanitize_key' ) ); $wp_customize->add_control( new Beetan_Customize_Radio_Image_Control( $wp_customize, 'blog_layout', array( 'label' => esc_html__( 'Layout', 'beetan' ), 'description' => esc_html__( 'Choose a layout for the blog posts.', 'beetan' ), 'section' => 'blog_options', 'choices' => array( 'default' => array( 'label' => esc_html__( 'Default', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/default.svg' ) ), 'list' => array( 'label' => esc_html__( 'List', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/list .svg' ) ), 'grid' => array( 'label' => esc_html__( 'Grid', 'beetan' ), 'url' => get_theme_file_uri( '/assets/images/grid.svg' ) ) ) ) ) ); /* Blog post content */ $wp_customize->add_setting( 'blog_content', array( 'default' => 'full', 'sanitize_callback' => 'beetan_sanitize_select' ) ); $wp_customize->add_control( 'blog_content', array( 'type' => 'radio', 'section' => 'blog_options', 'priority' => 10, 'label' => esc_html__( 'Archive Post Content', 'beetan' ), 'description' => esc_html__( 'Full content is only for DEFAULT layout.', 'beetan' ), 'choices' => array( 'full' => esc_html__( 'Show full content', 'beetan' ), 'summary' => esc_html__( 'Show summary', 'beetan' ), ), ) ); /* Blog excerpt length */ $wp_customize->add_setting( 'blog_excerpt_length', array( 'default' => 30, 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new Beetan_Customize_Number_Control( $wp_customize, 'blog_excerpt_length', array( 'label' => esc_html__( 'Summary Length', 'beetan' ), 'description' => esc_html__( 'Summary length as words count.', 'beetan' ), 'section' => 'blog_options', 'input_attrs' => array( 'min' => 10, 'max' => 50, 'step' => 5, ) ) ) ); /* Blog read more button */ $wp_customize->add_setting( 'blog_readmore', array( 'default' => true, 'sanitize_callback' => 'beetan_sanitize_boolean' ) ); $wp_customize->add_control( new Beetan_Customize_Toggle_Control( $wp_customize, 'blog_readmore', array( 'label' => esc_html__( 'Enable Read More', 'beetan' ), 'description' => wp_kses_post( __( 'Show READ MORE button.', 'beetan' ) ), 'section' => 'blog_options' ) ) ); /* * End Blog Settings */ /* * Start Color Settings */ $wp_customize->add_section( 'color_options', array( 'title' => esc_html__( 'Color Options', 'beetan' ), 'priority' => 37, ) ); // Theme color $wp_customize->add_setting( "primary_color", array( "default" => maybe_hash_hex_color( '#29B475' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => esc_html__( 'Primary Color', 'beetan' ), 'section' => 'color_options', ) ) ); // Body font color $wp_customize->add_setting( "text_color", array( "default" => maybe_hash_hex_color( '#343a40' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array( 'label' => esc_html__( 'Text Color', 'beetan' ), 'section' => 'color_options', ) ) ); // Heading font color $wp_customize->add_setting( "heading_color", array( "default" => maybe_hash_hex_color( '#16252d' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'heading_color', array( 'label' => esc_html__( 'Heading Color', 'beetan' ), 'section' => 'color_options', ) ) ); // Sub Heading font color $wp_customize->add_setting( "sub_heading_color", array( "default" => maybe_hash_hex_color( '#16252d' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sub_heading_color', array( 'label' => esc_html__( 'Sub Heading Color', 'beetan' ), 'section' => 'color_options', ) ) ); // Link color $wp_customize->add_setting( "link_color", array( "default" => maybe_hash_hex_color( '#343a40' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => esc_html__( 'Link Color', 'beetan' ), 'section' => 'color_options', ) ) ); // Link hover color $wp_customize->add_setting( "link_hover_color", array( "default" => maybe_hash_hex_color( '#29B475' ), "transport" => "postMessage", 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_hover_color', array( 'label' => esc_html__( 'Link Hover Color', 'beetan' ), 'section' => 'color_options', ) ) ); /* * End Color Settings */ } } add_action( 'customize_register', 'beetan_customize_register' );