register_section_type( Automobile_Shop_Button::class ); $manager->add_section( new Automobile_Shop_Button( $manager, 'automobile_shop_pro', [ 'title' => __( 'Automobile Shop Pro', 'automobile-shop' ), 'priority' => 0, 'button_text' => __( 'Go Pro', 'automobile-shop' ), 'button_url' => esc_url( 'https://www.luzuk.com/product/automobile-shop-wordpress-theme/', 'automobile-shop') ] ) ); } ); // Load the JS and CSS. add_action( 'customize_controls_enqueue_scripts', function() { $version = wp_get_theme()->get( 'Version' ); wp_enqueue_script( 'automobile-shop-customize-section-button', get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/js/customize-controls.js' ), [ 'customize-controls' ], $version, true ); wp_enqueue_style( 'automobile-shop-customize-section-button', get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/css/customize-controls.css' ), [ 'customize-controls' ], $version ); } ); function automobile_shop_customize_register( $wp_customize ) { $wp_customize->add_setting('automobile_shop_logo_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_logo_size',array( 'type' => 'range', 'description' => __('Logo Size (0-100%)','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_logo_margin',array( 'sanitize_callback' => 'esc_html' )); $wp_customize->add_control('automobile_shop_logo_margin',array( 'label' => __('Logo Margin','automobile-shop'), 'section' => 'title_tagline' )); $wp_customize->add_setting('automobile_shop_logo_top_margin',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_logo_top_margin',array( 'type' => 'number', 'description' => __('Top','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_logo_bottom_margin',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_logo_bottom_margin',array( 'type' => 'number', 'description' => __('Bottom','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_logo_left_margin',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_logo_left_margin',array( 'type' => 'number', 'description' => __('Left','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_logo_right_margin',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_logo_right_margin',array( 'type' => 'number', 'description' => __('Right','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_show_site_title',array( 'default' => true, 'sanitize_callback' => 'automobile_shop_sanitize_checkbox' )); $wp_customize->add_control('automobile_shop_show_site_title',array( 'type' => 'checkbox', 'label' => __('Show / Hide Site Title','automobile-shop'), 'section' => 'title_tagline' )); $wp_customize->add_setting('automobile_shop_site_title_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_site_title_font_size',array( 'type' => 'number', 'label' => __('Site Title Font Size','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_setting('automobile_shop_show_tagline',array( 'default' => true, 'sanitize_callback' => 'automobile_shop_sanitize_checkbox' )); $wp_customize->add_control('automobile_shop_show_tagline',array( 'type' => 'checkbox', 'label' => __('Show / Hide Site Tagline','automobile-shop'), 'section' => 'title_tagline' )); $wp_customize->add_setting('automobile_shop_site_tagline_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_site_tagline_font_size',array( 'type' => 'number', 'label' => __('Site Tagline Font Size','automobile-shop'), 'section' => 'title_tagline', )); $wp_customize->add_panel( 'automobile_shop_panel_id', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Theme Settings', 'automobile-shop' ), 'description' => __( 'Description of what this panel does.', 'automobile-shop' ), ) ); $wp_customize->add_section( 'automobile_shop_theme_options_section', array( 'title' => __( 'General Settings', 'automobile-shop' ), 'priority' => 30, 'panel' => 'automobile_shop_panel_id' ) ); $wp_customize->add_setting('automobile_shop_theme_options',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control('automobile_shop_theme_options',array( 'type' => 'select', 'label' => __('Blog Page Sidebar Layout','automobile-shop'), 'section' => 'automobile_shop_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','automobile-shop'), 'Right Sidebar' => __('Right Sidebar','automobile-shop'), 'One Column' => __('One Column','automobile-shop'), 'Grid Layout' => __('Grid Layout','automobile-shop') ), )); $wp_customize->add_setting('automobile_shop_single_post_sidebar',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control('automobile_shop_single_post_sidebar',array( 'type' => 'select', 'label' => __('Single Post Sidebar Layout','automobile-shop'), 'section' => 'automobile_shop_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','automobile-shop'), 'Right Sidebar' => __('Right Sidebar','automobile-shop'), 'One Column' => __('One Column','automobile-shop') ), )); $wp_customize->add_setting('automobile_shop_page_sidebar',array( 'default' => 'One Column', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control('automobile_shop_page_sidebar',array( 'type' => 'select', 'label' => __('Page Sidebar Layout','automobile-shop'), 'section' => 'automobile_shop_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','automobile-shop'), 'Right Sidebar' => __('Right Sidebar','automobile-shop'), 'One Column' => __('One Column','automobile-shop') ), )); $wp_customize->add_setting('automobile_shop_archive_page_sidebar',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control('automobile_shop_archive_page_sidebar',array( 'type' => 'select', 'label' => __('Archive & Search Page Sidebar Layout','automobile-shop'), 'section' => 'automobile_shop_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','automobile-shop'), 'Right Sidebar' => __('Right Sidebar','automobile-shop'), 'One Column' => __('One Column','automobile-shop'), 'Grid Layout' => __('Grid Layout','automobile-shop') ), )); $wp_customize->add_setting( 'automobile_shop_boxfull_width', array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control( 'automobile_shop_boxfull_width', array( 'label' => __( 'Section Width', 'automobile-shop' ), 'section' => 'automobile_shop_theme_options_section', 'type' => 'select', 'choices' => array( 'container' => __('Box Width', 'automobile-shop'), 'container-fluid' => __('Full Width', 'automobile-shop'), 'none' => __('None', 'automobile-shop') ), )); $wp_customize->add_setting( 'automobile_shop_dropdown_anim', array( 'default' => 'None', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control( 'automobile_shop_dropdown_anim', array( 'label' => __( 'Menu Dropdown Animations', 'automobile-shop' ), 'section' => 'automobile_shop_theme_options_section', 'type' => 'select', 'choices' => array( 'bounceInUp' => __('bounceInUp', 'automobile-shop'), 'fadeInUp' => __('fadeInUp', 'automobile-shop'), 'zoomIn' => __('zoomIn', 'automobile-shop'), 'None' => __('None', 'automobile-shop') ), )); //Header $wp_customize->add_section( 'automobile_shop_header_section' , array( 'title' => __( 'Header', 'automobile-shop' ), 'priority' => null, 'panel' => 'automobile_shop_panel_id' ) ); $wp_customize->add_setting('automobile_shop_phone_number',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_phone_number' )); $wp_customize->add_control('automobile_shop_phone_number',array( 'type' => 'text', 'label' => __('Add Phone Number','automobile-shop'), 'section' => 'automobile_shop_header_section', )); //home page slider $wp_customize->add_section( 'automobile_shop_slider_section' , array( 'title' => __( 'Slider Settings', 'automobile-shop' ), 'priority' => null, 'panel' => 'automobile_shop_panel_id' ) ); $wp_customize->add_setting('automobile_shop_slider_hide_show',array( 'default' => false, 'sanitize_callback' => 'automobile_shop_sanitize_checkbox' )); $wp_customize->add_control('automobile_shop_slider_hide_show',array( 'type' => 'checkbox', 'label' => __('Show / Hide Slider','automobile-shop'), 'section' => 'automobile_shop_slider_section', )); $wp_customize->add_setting( 'automobile_shop_slider_effect', array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_choices' )); $wp_customize->add_control( 'automobile_shop_slider_effect', array( 'label' => __( 'Onload Transactions Effects', 'automobile-shop' ), 'section' => 'automobile_shop_slider_section', 'type' => 'select', 'choices' => array( 'bounceInLeft' => __('bounceInLeft', 'automobile-shop'), 'bounceInRight' => __('bounceInRight', 'automobile-shop'), 'bounceInUp' => __('bounceInUp', 'automobile-shop'), 'bounceInDown' => __('bounceInDown', 'automobile-shop'), 'zoomIn' => __('zoomIn', 'automobile-shop'), 'zoomOut' => __('zoomOut', 'automobile-shop'), 'fadeInDown' => __('fadeInDown', 'automobile-shop'), 'fadeInUp' => __('fadeInUp', 'automobile-shop'), 'fadeInLeft' => __('fadeInLeft', 'automobile-shop'), 'fadeInRight' => __('fadeInRight', 'automobile-shop'), 'flip-up' => __('flip-up', 'automobile-shop'), 'none' => __('none', 'automobile-shop') ), )); for ( $count = 1; $count <= 4; $count++ ) { $wp_customize->add_setting( 'automobile_shop_slider' . $count, array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_dropdown_pages' )); $wp_customize->add_control( 'automobile_shop_slider' . $count, array( 'label' => __('Select Slider Image Page', 'automobile-shop' ), 'description'=> __('Image size (1400px x 600px)','automobile-shop'), 'section' => 'automobile_shop_slider_section', 'type' => 'dropdown-pages' )); } $wp_customize->add_setting('automobile_shop_slider_excerpt_length',array( 'default' => '6', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_slider_excerpt_length',array( 'type' => 'number', 'label' => __('Slider Excerpt Length','automobile-shop'), 'section' => 'automobile_shop_slider_section', )); $wp_customize->add_setting('automobile_shop_slider_title_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_slider_title_font_size',array( 'type' => 'number', 'label' => __('Title Font Size','automobile-shop'), 'section' => 'automobile_shop_slider_section', )); $wp_customize->add_setting('automobile_shop_slider_text_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_slider_text_font_size',array( 'type' => 'number', 'label' => __('Text Font Size','automobile-shop'), 'section' => 'automobile_shop_slider_section', )); $wp_customize->add_setting( 'automobile_shop_slider_text_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'automobile_shop_slider_text_color', array( 'label' => 'Text Color', 'section' => 'automobile_shop_slider_section', ))); $wp_customize->add_setting( 'automobile_shop_slider_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'automobile_shop_slider_color', array( 'label' => 'Title Color', 'section' => 'automobile_shop_slider_section', ))); $wp_customize->add_setting( 'automobile_shop_slider_btn_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'automobile_shop_slider_btn_color', array( 'label' => 'Button Text Color', 'section' => 'automobile_shop_slider_section', ))); $wp_customize->add_setting( 'automobile_shop_slider_btnbdr_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'automobile_shop_slider_btnbdr_color', array( 'label' => 'Button Border Color', 'section' => 'automobile_shop_slider_section', ))); $wp_customize->add_setting( 'automobile_shop_slider_btnbg_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'automobile_shop_slider_btnbg_color', array( 'label' => 'Overlay Color', 'section' => 'automobile_shop_slider_section', ))); //Services Section $wp_customize->add_section('automobile_shop_service_section',array( 'title' => __('Service Section','automobile-shop'), 'description'=> __('Note : This section will appear below the slider','automobile-shop'), 'panel' => 'automobile_shop_panel_id', )); $wp_customize->add_setting('automobile_shop_small_title',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automobile_shop_small_title',array( 'label' => __('Section Small Title','automobile-shop'), 'section' => 'automobile_shop_service_section', 'type' => 'text' )); $wp_customize->add_setting('automobile_shop_small_title_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_small_title_font_size',array( 'type' => 'number', 'label' => __('Font Size','automobile-shop'), 'section' => 'automobile_shop_service_section', )); $wp_customize->add_setting('automobile_shop_section_title',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automobile_shop_section_title',array( 'label' => __('Section Title','automobile-shop'), 'section' => 'automobile_shop_service_section', 'type' => 'text' )); $wp_customize->add_setting('automobile_shop_section_title_font_size',array( 'default' => '', 'sanitize_callback' => 'automobile_shop_sanitize_float' )); $wp_customize->add_control('automobile_shop_section_title_font_size',array( 'type' => 'number', 'label' => __('Font Size','automobile-shop'), 'section' => 'automobile_shop_service_section', )); $categories = get_categories(); $cats = array(); $i = 0; $cat_pst[]= 'select'; foreach($categories as $category){ if($i==0){ $default = $category->slug; $i++; } $cat_pst[$category->slug] = $category->name; } $wp_customize->add_setting('automobile_shop_category_setting',array( 'default' => 'select', 'sanitize_callback' => 'automobile_shop_sanitize_choices', )); $wp_customize->add_control('automobile_shop_category_setting',array( 'type' => 'select', 'choices' => $cat_pst, 'label' => __('Select Category To Display Post','automobile-shop'), 'section' => 'automobile_shop_service_section', )); $wp_customize->add_setting('automobile_shop_service_number',array( 'default' => '4', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('automobile_shop_service_number',array( 'label' => __('Number Of Posts To Show In A Category','automobile-shop'), 'section' => 'automobile_shop_service_section', 'type' => 'number' )); $automobile_shop_service_number = get_theme_mod('automobile_shop_service_number', 4); for ($i=1; $i <= $automobile_shop_service_number; $i++) { $wp_customize->add_setting('automobile_shop_service_icon' . $i, array( 'default' => 'fas fa-car', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control(new Automobile_Shop_Fontawesome_Icon_Chooser($wp_customize, 'automobile_shop_service_icon' . $i, array( 'section' => 'automobile_shop_service_section', 'type' => 'icon', 'label' => esc_html__('Service Icon ', 'automobile-shop') . $i ))); } //Footer $wp_customize->add_section( 'automobile_shop_footer', array( 'title' => __( 'Footer Settings', 'automobile-shop' ), 'priority' => null, 'panel' => 'automobile_shop_panel_id' ) ); $wp_customize->add_setting('automobile_shop_show_back_totop',array( 'default' => true, 'sanitize_callback' => 'automobile_shop_sanitize_checkbox' )); $wp_customize->add_control('automobile_shop_show_back_totop',array( 'type' => 'checkbox', 'label' => __('Show / Hide Back to Top','automobile-shop'), 'section' => 'automobile_shop_footer' )); $wp_customize->add_setting('automobile_shop_footer_copy',array( 'default' => 'Automobile Shop WordPress Theme', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('automobile_shop_footer_copy',array( 'label' => __('Copyright Text','automobile-shop'), 'section' => 'automobile_shop_footer', 'setting' => 'automobile_shop_footer_copy', 'type' => 'text' )); $wp_customize->register_section_type( Automobile_Shop_Button::class ); $wp_customize->add_section( new Automobile_Shop_Button( $wp_customize, 'automobile_shop_pro_link', [ 'title' => __( 'Automobile Shop Pro', 'automobile-shop' ), 'priority' => 0, 'button_text' => __( 'Go Pro', 'automobile-shop' ), 'button_url' => esc_url( 'https://www.luzuk.com/product/automobile-shop-wordpress-theme/', 'automobile-shop'), 'panel' => 'automobile_shop_panel_id' ] ) ); $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'automobile_shop_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'automobile_shop_customize_partial_blogdescription', ) ); } add_action( 'customize_register', 'automobile_shop_customize_register' ); function automobile_shop_customize_partial_blogname() { bloginfo( 'name' ); } function automobile_shop_customize_partial_blogdescription() { bloginfo( 'description' ); } function automobile_shop_is_static_front_page() { return ( is_front_page() && ! is_home() ); } function automobile_shop_is_view_with_layout_option() { // This option is available on all pages. It's also available on archives when there isn't a sidebar. return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) ); } if (class_exists('WP_Customize_Control')) { class Automobile_Shop_Fontawesome_Icon_Chooser extends WP_Customize_Control { public $type = 'icon'; public function render_content() { ?>