remove_setting( 'automobile_hub_mail_text' );
$wp_customize->remove_control( 'automobile_hub_mail_text' );
$wp_customize->remove_setting( 'automobile_hub_call_text' );
$wp_customize->remove_control( 'automobile_hub_call_text' );
$wp_customize->remove_setting( 'automobile_hub_menu_font_size' );
$wp_customize->remove_control( 'automobile_hub_menu_font_size' );
$wp_customize->remove_setting( 'automobile_hub_about_icon' );
$wp_customize->remove_control( 'automobile_hub_about_icon' );
}
add_action( 'customize_register', 'auto_car_care_remove_customize_register', 11 );
if ( ! defined( 'AUTO_CAR_CARE_TEXT' ) ) {
define( 'AUTO_CAR_CARE_TEXT', __( 'Auto Car Care Pro','auto-car-care' ));
}
if ( ! defined( 'AUTO_CAR_CARE_BUY_TEXT' ) ) {
define( 'AUTO_CAR_CARE_BUY_TEXT', __( 'Upgrade Pro','auto-car-care' ));
}
add_action( 'customize_register', function( $manager ) {
// Load custom sections.
load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );
$manager->register_section_type( Automobile_Hub_Button::class );
$manager->add_section(
new Automobile_Hub_Button( $manager, 'automobile_hub_pro', [
'title' => esc_html( AUTO_CAR_CARE_TEXT,'auto-car-care' ),
'priority' => 0,
'button_text' => __( 'GET PREMIUM', 'auto-car-care' ),
'button_url' => esc_url( AUTOMOBILE_HUB_PRO_THEME_URL )
] )
);
} );
function auto_car_care_customize_register( $wp_customize ) {
// Pro Version
class Auto_Car_Care_Customize_Pro_Version extends WP_Customize_Control {
public $type = 'pro_options';
public function render_content() {
echo 'Unlock Premium '. esc_html( $this->label ) .'? ';
echo '';
echo '';
echo ' '. esc_html( AUTO_CAR_CARE_BUY_TEXT,'auto-car-care' ) .'';
echo '';
}
}
// Custom Controls
function auto_car_care_sanitize_custom_control( $input ) {
return $input;
}
// Register the custom control type.
$wp_customize->register_control_type( 'Auto_Car_Care_Toggle_Control' );
$wp_customize->add_setting('automobile_hub_address',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('automobile_hub_address',array(
'label' => __('Add Location','auto-car-care'),
'section' => 'automobile_hub_topbar',
'type' => 'text'
));
$wp_customize->add_section( 'auto_car_care_topbar_section' , array(
'title' => __( 'Topbar Settings', 'auto-car-care' ),
'priority' => 3,
'panel' => 'automobile_hub_panel_id'
) );
$wp_customize->add_setting('auto_car_care_my_account_link',array(
'default' => '',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('auto_car_care_my_account_link',array(
'label' => __('My Account Page Link','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'url'
));
$wp_customize->add_setting('auto_car_care_my_account_text',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('auto_car_care_my_account_text',array(
'label' => __('My Account Text','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'text'
));
$wp_customize->selective_refresh->add_partial( 'auto_car_care_my_account_text', array(
'selector' => '.topbarbox a',
'render_callback' => 'auto_car_care_customize_partial_auto_car_care_my_account_text',
) );
$wp_customize->add_setting('auto_car_care_wishlist_link',array(
'default' => '',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('auto_car_care_wishlist_link',array(
'label' => __('My Wishlist Page Link','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'url'
));
$wp_customize->add_setting('auto_car_care_wishlist_text',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('auto_car_care_wishlist_text',array(
'label' => __('My Compare Page Text','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'text'
));
$wp_customize->add_setting('auto_car_care_compare_link',array(
'default' => '',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('auto_car_care_compare_link',array(
'label' => __('My Compare Page Link','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'url'
));
$wp_customize->add_setting('auto_car_care_compare_text',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('auto_car_care_compare_text',array(
'label' => __('My Wishlist Text','auto-car-care'),
'section' => 'auto_car_care_topbar_section',
'type' => 'text'
));
// Pro Version
$wp_customize->add_setting( 'auto_car_care_top_bar_pro_version_logo', array(
'sanitize_callback' => 'auto_car_care_sanitize_custom_control'
));
$wp_customize->add_control( new Auto_Car_Care_Customize_Pro_Version ( $wp_customize,'auto_car_care_top_bar_pro_version_logo', array(
'section' => 'auto_car_care_topbar_section',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'auto-car-care' ),
'description' => esc_url( AUTOMOBILE_HUB_PRO_THEME_URL ),
'priority' => 10,
)));
// Abouts us
$wp_customize->add_setting( 'auto_car_care_about_points', array(
'default' => 6,
'type' => 'theme_mod',
'transport' => 'refresh',
'sanitize_callback' => 'automobile_hub_sanitize_number_range',
'sanitize_js_callback' => 'absint',
) );
$wp_customize->add_control( 'auto_car_care_about_points', array(
'label' => esc_html__( 'Add number of points','auto-car-care' ),
'section' => 'automobile_hub_about_section',
'type' => 'number',
'input_attrs' => array(
'step' => 1,
'min' => 0,
'max' => 10,
),
) );
$auto_car_care_about_point = get_theme_mod('auto_car_care_about_points',6);
for ( $m = 1; $m <= $auto_car_care_about_point; $m++ ){
$wp_customize->add_setting('auto_car_care_about_points_text'.$m,array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('auto_car_care_about_points_text'.$m,array(
'label' => __('Add Text ','auto-car-care').$m,
'section' => 'automobile_hub_about_section',
'type' => 'text'
));
}
// Contact Form
$wp_customize->add_section( 'auto_car_care_contact_section' , array(
'title' => __( 'Contact Form Settings', 'auto-car-care' ),
'priority' => 4,
'panel' => 'automobile_hub_panel_id'
) );
$wp_customize->add_setting( 'auto_car_care_topbar_show_hide', array(
'default' => false,
'transport' => 'refresh',
'sanitize_callback' => 'automobile_hub_sanitize_checkbox',
) );
$wp_customize->add_control( new Auto_Car_Care_Toggle_Control( $wp_customize, 'auto_car_care_topbar_show_hide', array(
'label' => esc_html__( 'Show / Hide section', 'auto-car-care' ),
'section' => 'auto_car_care_contact_section',
'type' => 'toggle',
'settings' => 'auto_car_care_topbar_show_hide',
) ) );
$wp_customize->add_setting('auto_car_care_contact_form_shortcode',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('auto_car_care_contact_form_shortcode',array(
'label' => __('Add Contact Form 7 Shortcode','auto-car-care'),
'section' => 'auto_car_care_contact_section',
'type' => 'text'
));
// Pro Version
$wp_customize->add_setting( 'auto_car_care_services_pro_version_logo', array(
'sanitize_callback' => 'auto_car_care_sanitize_custom_control'
));
$wp_customize->add_control( new Auto_Car_Care_Customize_Pro_Version ( $wp_customize,'auto_car_care_services_pro_version_logo', array(
'section' => 'auto_car_care_contact_section',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'auto-car-care' ),
'description' => esc_url( AUTOMOBILE_HUB_PRO_THEME_URL ),
'priority' => 10,
)));
}
add_action( 'customize_register', 'auto_car_care_customize_register' );