register_control_type( 'Automotive_Services_Control_Upgrade' ); $selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh'; $wp_customize->add_panel( 'automotive_services_frontpage_sections', array( 'priority' => 1, 'title' => esc_html__( 'Frontpage Sections', 'automotive-services' ), ) ); /*========================================= Slider Section =========================================*/ $wp_customize->add_section( 'automotive_services_slider_section', array( 'title' => esc_html__( 'Slider Section', 'automotive-services' ), 'priority' => 13, 'panel' => 'automotive_services_frontpage_sections', ) ); // Slider Hide/ Show Setting // $wp_customize->add_setting( 'automotive_services_slider_setting' , array( 'default' => false, 'sanitize_callback' => 'automotive_services_sanitize_checkbox', 'capability' => 'edit_theme_options', 'priority' => 2, ) ); $wp_customize->add_control( 'automotive_services_slider_setting', array( 'label' => esc_html__( 'Hide / Show Section', 'automotive-services' ), 'section' => 'automotive_services_slider_section', 'settings' => 'automotive_services_slider_setting', 'type' => 'checkbox' ) ); $wp_customize->add_setting('automotive_services_slider_side_text',array( 'default'=> 'WELCOME!', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automotive_services_slider_side_text',array( 'label' => __('Add Slider Side Text','automotive-services'), 'section'=> 'automotive_services_slider_section', 'type'=> 'text' )); for ( $automotive_services_count = 1; $automotive_services_count <= 3; $automotive_services_count++ ) { // Add setting and control $wp_customize->add_setting( 'automotive_services_slider_page' . $automotive_services_count, array( 'sanitize_callback' => 'automotive_services_sanitize_dropdown_pages' ) ); $wp_customize->add_control( 'automotive_services_slider_page' . $automotive_services_count, array( 'label' => __( 'Select Slide Image Page', 'automotive-services' ), 'section' => 'automotive_services_slider_section', 'type' => 'dropdown-pages' ) ); } // Slider Text $wp_customize->add_setting( 'automotive_services_slider_short_heading', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', 'priority' => 1, ) ); $wp_customize->add_control( 'automotive_services_slider_short_heading', array( 'label' => __('Slider Top Text','automotive-services'), 'section' => 'automotive_services_slider_section', 'type' => 'text', 'transport' => $selective_refresh, ) ); $wp_customize->add_setting( 'automotive_services_slider_btn_text', array( 'default' => 'Get Started', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'automotive_services_slider_btn_text', array( 'label' => __('Slider Button Text','automotive-services'), 'section' => 'automotive_services_slider_section', 'type' => 'text', 'transport' => $selective_refresh, ) ); $wp_customize->add_setting( 'automotive_services_slider_btn_link', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'automotive_services_slider_btn_link', array( 'label' => __('Slider Button Link','automotive-services'), 'section' => 'automotive_services_slider_section', 'type' => 'url', 'transport' => $selective_refresh, ) ); $wp_customize->add_setting( 'automotive_services_upgrade_page_settings_3', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new Automotive_Services_Control_Upgrade( $wp_customize, 'automotive_services_upgrade_page_settings_3', array( 'priority' => 200, 'section' => 'automotive_services_slider_section', 'settings' => 'automotive_services_upgrade_page_settings_3', 'label' => __( 'Automotive Services Pro comes with additional features.', 'automotive-services' ), 'choices' => array( __( '15+ Ready-Made Sections', 'automotive-services' ), __( 'One-Click Demo Import', 'automotive-services' ), __( 'WooCommerce Integrated', 'automotive-services' ), __( 'Drag & Drop Section Reordering', 'automotive-services' ),__( 'Advanced Typography Control', 'automotive-services' ),__( 'Intuitive Customization Options', 'automotive-services' ),__( '24/7 Support', 'automotive-services' ), ) ) ) ); /*========================================= service Section =========================================*/ $wp_customize->add_section( 'automotive_services_service_section', array( 'title' => esc_html__( 'Best Service Section', 'automotive-services' ), 'priority' => 14, 'panel' => 'automotive_services_frontpage_sections', ) ); // Hide/ Show Setting // $wp_customize->add_setting( 'automotive_services_service_show_hide' , array( 'default' => true, 'sanitize_callback' => 'automotive_services_sanitize_checkbox', 'capability' => 'edit_theme_options', 'priority' => 2, ) ); $wp_customize->add_control( 'automotive_services_service_show_hide', array( 'label' => esc_html__( 'Hide / Show Section', 'automotive-services' ), 'section' => 'automotive_services_service_section', 'settings' => 'automotive_services_service_show_hide', 'type' => 'checkbox' ) ); $wp_customize->add_setting('automotive_services_service_about_us', array( 'default' => 'Best Service', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automotive_services_service_about_us', array( 'label' => __('Add About Us Background text', 'automotive-services'), 'section' => 'automotive_services_service_section', 'type' => 'text' )); $wp_customize->add_setting('automotive_services_service_sub_heading', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automotive_services_service_sub_heading', array( 'label' => __('Add Heading', 'automotive-services'), 'section' => 'automotive_services_service_section', 'type' => 'text' )); $wp_customize->add_setting('automotive_services_service_about_us_content', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automotive_services_service_about_us_content', array( 'label' => __('Add About Us Content', 'automotive-services'), 'section' => 'automotive_services_service_section', 'type' => 'text' )); $automotive_services_categories = get_categories(); $automotive_services_cats = array(); $automotive_services_i = 0; $automotive_services_offer_cat[]= 'select'; foreach($automotive_services_categories as $automotive_services_category){ if($automotive_services_i==0){ $automotive_services_default = $automotive_services_category->slug; $automotive_services_i++; } $automotive_services_offer_cat[$automotive_services_category->slug] = $automotive_services_category->name; } $wp_customize->add_setting( 'automotive_services_offer_section_category', array( 'default' => 'uncategorized', 'sanitize_callback' => 'automotive_services_sanitize_choices', ) ); $wp_customize->add_control( 'automotive_services_offer_section_category', array( 'type' => 'select', 'choices' => $automotive_services_offer_cat, 'label' => __('Select Category','automotive-services'), 'section' => 'automotive_services_service_section', ) ); // Add Number of Posts Setting $wp_customize->add_setting('automotive_services_num_posts', array( 'default' => 6, 'sanitize_callback' => 'absint', )); $wp_customize->add_control('automotive_services_num_posts', array( 'label' => __('Number of Posts to Show', 'automotive-services'), 'section' => 'automotive_services_service_section', 'type' => 'number', )); // Dynamically Add Icon Settings $automotive_services_services_count = get_theme_mod('automotive_services_num_posts', 6); for ($automotive_services_i = 1; $automotive_services_i <= $automotive_services_services_count; $automotive_services_i++) { $wp_customize->add_setting('automotive_services_services_icon' . $automotive_services_i, array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('automotive_services_services_icon' . $automotive_services_i, array( 'label' => __('Icon ', 'automotive-services') . $automotive_services_i, 'description' => __('Use Font Awesome icons like fas fa-tools', 'automotive-services'), 'section' => 'automotive_services_service_section', 'type' => 'text', )); } $wp_customize->add_setting( 'automotive_services_upgrade_page_settings_44', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new Automotive_Services_Control_Upgrade( $wp_customize, 'automotive_services_upgrade_page_settings_44', array( 'priority' => 200, 'section' => 'automotive_services_service_section', 'settings' => 'automotive_services_upgrade_page_settings_44', 'label' => __( 'Automotive Services Pro comes with additional features.', 'automotive-services' ), 'choices' => array( __( '15+ Ready-Made Sections', 'automotive-services' ), __( 'One-Click Demo Import', 'automotive-services' ), __( 'WooCommerce Integrated', 'automotive-services' ), __( 'Drag & Drop Section Reordering', 'automotive-services' ),__( 'Advanced Typography Control', 'automotive-services' ),__( 'Intuitive Customization Options', 'automotive-services' ),__( '24/7 Support', 'automotive-services' ), ) ) ) ); } add_action( 'customize_register', 'automotive_services_blog_setting' ); // service selective refresh function automotive_services_blog_section_partials( $wp_customize ){ // blog_title $wp_customize->selective_refresh->add_partial( 'blog_title', array( 'selector' => '.home-blog .title h6', 'settings' => 'blog_title', 'render_callback' => 'automotive_services_blog_title_render_callback', ) ); // blog_subtitle $wp_customize->selective_refresh->add_partial( 'blog_subtitle', array( 'selector' => '.home-blog .title h2', 'settings' => 'blog_subtitle', 'render_callback' => 'automotive_services_blog_subtitle_render_callback', ) ); // blog_description $wp_customize->selective_refresh->add_partial( 'blog_description', array( 'selector' => '.home-blog .title p', 'settings' => 'blog_description', 'render_callback' => 'automotive_services_blog_description_render_callback', ) ); } add_action( 'customize_register', 'automotive_services_blog_section_partials' ); // blog_title function automotive_services_blog_title_render_callback() { return get_theme_mod( 'blog_title' ); } // blog_subtitle function automotive_services_blog_subtitle_render_callback() { return get_theme_mod( 'blog_subtitle' ); } // service description function automotive_services_blog_description_render_callback() { return get_theme_mod( 'blog_description' ); }