get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; get_template_part('inc/customizer-button/upsell-section'); if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'aether_blog_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'aether_blog_customize_partial_blogdescription', ) ); } $wp_customize->register_section_type( 'aether_blog_Customize_Upsell_Section' ); // Register section. $wp_customize->add_section( new aether_blog_Customize_Upsell_Section( $wp_customize, 'theme_upsell', array( 'title' => esc_html__( 'Aether Blog Pro', 'aether-blog' ), 'pro_text' => esc_html__( 'Upgrade To Pro', 'aether-blog' ), 'pro_url' => 'https://cawpthemes.com/aether-blog-premium-wordpress-theme/', 'priority' => 1, ) ) ); } add_action( 'customize_register', 'aether_blog_customize_register_btn' ); /** * Render the site title for the selective refresh partial. * * @return void */ function aether_blog_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function aether_blog_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function aether_blog_customize_preview_js() { wp_enqueue_script( 'aether-blog-customizer', get_template_directory_uri() . '/inc/customizer-button/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'aether_blog_customize_preview_js' ); /** * Customizer control scripts and styles. * * @since 1.0.0 */ function aether_blog_customizer_control_scripts() { wp_enqueue_style( 'aether-blog-customize-controls', get_template_directory_uri() . '/inc/customizer-button/customize-controls.css', '', '1.0.0' ); wp_enqueue_script( 'aether-blog-customize-controls', get_template_directory_uri() . '/inc/customizer-button/customize-controls.js', array( 'customize-controls' ), '1.0.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'aether_blog_customizer_control_scripts', 0 ); //-----Code to add the Upgrade to Pro button in the Customizer End---------- //------------------Theme Information-------------------- function aether_blog_customize_register( $wp_customize ) { // Add a custom setting for the Site Identity color $wp_customize->add_setting( 'aether_blog_site_identity_color', array( 'default' => '#000', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Add a custom control for the primary color $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'aether_blog_site_identity_color', array( 'label' => __( 'Site Identity Color', 'aether-blog' ), 'section' => 'title_tagline', 'settings' => 'aether_blog_site_identity_color', ) ) ); // Add a custom setting for the Site Identity color $wp_customize->add_setting( 'aether_blog_site_identity_tagline_color', array( 'default' => '#000', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Add a custom control for the primary color $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'aether_blog_site_identity_tagline_color', array( 'label' => __( 'Tagline Color', 'aether-blog' ), 'section' => 'title_tagline', 'settings' => 'aether_blog_site_identity_tagline_color', ) ) ); //------------------Site Identity Ends--------------------- // Add a custom setting for the primary color $wp_customize->add_setting( 'aether_blog_primary_color', array( 'default' => '#000', 'sanitize_callback' => 'sanitize_hex_color', ) ); // Add a custom control for the primary color $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'aether_blog_primary_color', array( 'label' => __( 'Primary Color', 'aether-blog' ), 'section' => 'colors', 'settings' => 'aether_blog_primary_color', ) ) ); //----------Home Front Page----------------- $wp_customize->add_panel( 'aether_blog_panel', array( 'title' => __( 'Front Page Settings', 'aether-blog' ), 'priority' => 6, ) ); $wp_customize->add_section( 'aether_topbar_section', array( 'title' => __( 'Top Bar Settings', 'aether-blog' ), 'panel' => 'aether_blog_panel', ) ); // Email $wp_customize->add_setting( 'aether_topbar_email', array( 'default' => '', 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( 'aether_topbar_email', array( 'label' => __( 'Email Address', 'aether-blog' ), 'section' => 'aether_topbar_section', 'type' => 'text', ) ); // Phone $wp_customize->add_setting( 'aether_topbar_phone', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aether_topbar_phone', array( 'label' => __( 'Phone Number', 'aether-blog' ), 'section' => 'aether_topbar_section', 'type' => 'text', ) ); // Facebook $wp_customize->add_setting( 'aether_topbar_facebook', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'aether_topbar_facebook', array( 'label' => __( 'Facebook URL', 'aether-blog' ), 'section' => 'aether_topbar_section', 'type' => 'url', ) ); // Twitter $wp_customize->add_setting( 'aether_topbar_twitter', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'aether_topbar_twitter', array( 'label' => __( 'Twitter URL', 'aether-blog' ), 'section' => 'aether_topbar_section', 'type' => 'url', ) ); // Instagram $wp_customize->add_setting( 'aether_topbar_instagram', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'aether_topbar_instagram', array( 'label' => __( 'Instagram URL', 'aether-blog' ), 'section' => 'aether_topbar_section', 'type' => 'url', ) ); // -----------------Hero Section---------- $wp_customize->add_section('aether_blog_hero_section', array( 'title' => __('Hero Section', 'aether-blog'), 'panel' => 'aether_blog_panel', )); $wp_customize->add_setting('aether_blog_hero_heading', array( 'default' => __('Welcome to Aether Blog', 'aether-blog'), 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_hero_heading', array( 'label' => __('Hero Heading', 'aether-blog'), 'section' => 'aether_blog_hero_section', 'type' => 'text', )); $wp_customize->add_setting('aether_blog_hero_subheading', array( 'default' => __('A calm space for your mindful words.', 'aether-blog'), 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_hero_subheading', array( 'label' => __('Hero Subheading', 'aether-blog'), 'section' => 'aether_blog_hero_section', 'type' => 'text', )); $wp_customize->add_setting('aether_blog_hero_button_text', array( 'default' => __('Read the Blog', 'aether-blog'), 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_hero_button_text', array( 'label' => __('Button Text', 'aether-blog'), 'section' => 'aether_blog_hero_section', 'type' => 'text', )); $wp_customize->add_setting('aether_blog_hero_button_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('aether_blog_hero_button_url', array( 'label' => __('Button URL', 'aether-blog'), 'section' => 'aether_blog_hero_section', 'type' => 'url', )); $wp_customize->add_setting('aether_blog_hero_bg', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'aether_blog_hero_bg', array( 'label' => __('Background Image', 'aether-blog'), 'section' => 'aether_blog_hero_section', 'settings' => 'aether_blog_hero_bg', ))); // ----------Minimal Quote Spotlight Section $wp_customize->add_section( 'aether_quote_section', array( 'title' => __( 'Quote Spotlight Section', 'aether-blog' ), 'panel' => 'aether_blog_panel', 'description' => __( 'Displays a minimal quote with author and optional CTA.', 'aether-blog' ), ) ); // Quote Text $wp_customize->add_setting( 'aether_blog_quote_text', array( 'default' => '“Simplicity is the ultimate sophistication.”', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aether_blog_quote_text', array( 'label' => __( 'Quote Text', 'aether-blog' ), 'section' => 'aether_quote_section', 'type' => 'text', ) ); // Quote Author $wp_customize->add_setting( 'aether_blog_quote_author', array( 'default' => 'Leonardo da Vinci', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aether_blog_quote_author', array( 'label' => __( 'Quote Author', 'aether-blog' ), 'section' => 'aether_quote_section', 'type' => 'text', ) ); // CTA Text $wp_customize->add_setting( 'aether_blog_cta_text', array( 'default' => 'Read More', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aether_blog_cta_text', array( 'label' => __( 'CTA Button Text', 'aether-blog' ), 'section' => 'aether_quote_section', 'type' => 'text', ) ); // CTA URL $wp_customize->add_setting( 'aether_blog_cta_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'aether_blog_cta_url', array( 'label' => __( 'CTA Button URL', 'aether-blog' ), 'section' => 'aether_quote_section', 'type' => 'url', ) ); //-------------------Featured Post-------------- $wp_customize->add_section('aether_blog_featured_section', array( 'title' => __('Featured Posts', 'aether-blog'), 'panel' => 'aether_blog_panel', )); $wp_customize->add_setting('aether_blog_featured_title', array( 'default' => __('Featured Reads', 'aether-blog'), 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_featured_title', array( 'label' => __('Section Title', 'aether-blog'), 'section' => 'aether_blog_featured_section', 'type' => 'text', )); //-----------Category------------ $categories = get_categories(); $cats = array(); $i = 0; foreach($categories as $category){ if($i==0){ $default = $category->name; $i++; } $cats[$category->name] = $category->name; } $wp_customize->add_setting('aether_blog_featured_category',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_featured_category',array( 'type' => 'select', 'choices' => $cats, 'label' => __('Select Category for Featured Post','aether-blog'), 'section' => 'aether_blog_featured_section', 'sanitize_callback' => 'sanitize_text_field', )); //---------- Mindful Living Section (Free) $wp_customize->add_section( 'aether_blog_mindful_section', array( 'title' => __( 'Mindful Living Section', 'aether-blog' ), 'panel' => 'aether_blog_panel', 'description' => __( 'Settings for the Mindful Living posts section on the homepage.', 'aether-blog' ), ) ); // Section Title $wp_customize->add_setting( 'aether_blog_mindful_title', array( 'default' => __( 'Latest in Mindful Living', 'aether-blog' ), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aether_blog_mindful_title', array( 'label' => __( 'Section Title', 'aether-blog' ), 'section' => 'aether_blog_mindful_section', 'type' => 'text', ) ); //-----------Category------------ $categories = get_categories(); $cats = array(); $i = 0; foreach($categories as $category){ if($i==0){ $default = $category->name; $i++; } $cats[$category->name] = $category->name; } $wp_customize->add_setting('aether_blog_mindful_category',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_mindful_category',array( 'type' => 'select', 'choices' => $cats, 'label' => __('Select Category to Display Post','aether-blog'), 'section' => 'aether_blog_mindful_section', 'sanitize_callback' => 'sanitize_text_field', )); //------------------------Blog Page Settings-------------------------- $wp_customize->add_section( 'aether_blog_blogpage_settings', array( 'title' => __( 'Blog Page Settings', 'aether-blog' ), 'panel' => 'aether_blog_panel', ) ); //--------------Section One Title----------------------- $wp_customize->add_setting('aether_blog_blogpage_title',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('aether_blog_blogpage_title',array( 'label' => __('Blog Page Title','aether-blog'), 'section' => 'aether_blog_blogpage_settings', 'setting' => 'aether_blog_blogpage_title', 'type' => 'text' ) ); //-----------Category------------ $categories = get_categories(); $cats = array(); $i = 0; foreach($categories as $category){ if($i==0){ $default = $category->name; $i++; } $cats[$category->name] = $category->name; } $wp_customize->add_setting('aether_blog_blogpage_category',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('aether_blog_blogpage_category',array( 'type' => 'select', 'choices' => $cats, 'label' => __('Select Category to Display Post on Blog Page','aether-blog'), 'section' => 'aether_blog_blogpage_settings', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_setting('aether_blogblog_page_category_number_of_posts_setting',array( 'default' => '18', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('aether_blogblog_page_category_number_of_posts_setting',array( 'label' => __('Number of Posts','aether-blog'), 'section' => 'aether_blog_blogpage_settings', 'setting' => 'aether_blogblog_page_category_number_of_posts_setting', 'type' => 'number' )); //-------------------------Footer Settings------------------------------ $wp_customize->add_section( 'aether_blog_footer', array( 'title' => __( 'Footer Settings', 'aether-blog' ), 'panel' => 'aether_blog_panel', ) ); // Add a custom setting for the footer text $wp_customize->add_setting( 'aether_blog_footer_text', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); // Add a custom control for the footer text $wp_customize->add_control( 'aether_blog_footer_text', array( 'label' => __( 'Footer Text', 'aether-blog' ), 'section' => 'aether_blog_footer', 'type' => 'text', ) ); //-------------------404 Page----------- $wp_customize->add_section( 'aether_blog_404page', array( 'title' => __( '404 Page Settings', 'aether-blog' ), 'panel' => 'aether_blog_panel', ) ); // Add a custom setting for the footer text $wp_customize->add_setting( 'aether_blog_404page_title', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); // Add a custom control for the footer text $wp_customize->add_control( 'aether_blog_404page_title', array( 'label' => __( 'Page Not Found Title', 'aether-blog' ), 'section' => 'aether_blog_404page', 'type' => 'text', ) ); // Add a custom setting for the footer text $wp_customize->add_setting( 'aether_blog_404page_text', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); // Add a custom control for the footer text $wp_customize->add_control( 'aether_blog_404page_text', array( 'label' => __( 'Page Not Found Text', 'aether-blog' ), 'section' => 'aether_blog_404page', 'type' => 'text', ) ); //------General Settings------------------------------------------ $wp_customize->add_section( 'aether_blog_general', array( 'title' => __( 'General Settings', 'aether-blog' ), 'panel' => 'aether_blog_panel', ) ); $wp_customize->add_setting( 'aether_blog_post_meta_toggle_switch_control', array( 'default' => true, 'sanitize_callback' => 'sanitize_text_field', // Use a suitable sanitization function based on your needs 'transport' => 'refresh', // or 'postMessage' for instant preview without page refresh ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'aether_blog_post_meta_toggle_switch_control', array( 'label' => __( 'Display Time/Author', 'aether-blog' ), 'section' => 'aether_blog_general', 'settings' => 'aether_blog_post_meta_toggle_switch_control', 'type' => 'checkbox', ) ) ); $wp_customize->add_setting( 'aether_blog_post_readmore_toggle_switch_control', array( 'default' => true, 'sanitize_callback' => 'sanitize_text_field', // Use a suitable sanitization function based on your needs 'transport' => 'refresh', // or 'postMessage' for instant preview without page refresh ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'aether_blog_post_readmore_toggle_switch_control', array( 'label' => __( 'Display Readmore Link', 'aether-blog' ), 'section' => 'aether_blog_general', 'settings' => 'aether_blog_post_readmore_toggle_switch_control', 'type' => 'checkbox', ) ) ); } add_action( 'customize_register', 'aether_blog_customize_register' );