remove_section( 'automobile_hub_topbar' );
$wp_customize->remove_setting( 'automobile_hub_sticky' );
$wp_customize->remove_control( 'automobile_hub_sticky' );
$wp_customize->remove_setting( 'automobile_hub_menu_font_size' );
$wp_customize->remove_control( 'automobile_hub_menu_font_size' );
$wp_customize->remove_setting( 'automobile_hub_tp_color_option_link' );
$wp_customize->remove_control( 'automobile_hub_tp_color_option_link' );
$wp_customize->remove_setting( 'automobile_hub_slider_icon' );
$wp_customize->remove_control( 'automobile_hub_slider_icon' );
$wp_customize->remove_setting( 'automobile_hub_about_icon' );
$wp_customize->remove_control( 'automobile_hub_about_icon' );
$wp_customize->remove_setting( 'automobile_hub_slider_text' );
$wp_customize->remove_control( 'automobile_hub_slider_text' );
}
add_action( 'customize_register', 'automotive_charging_station_remove_customize_register', 11 );
if ( ! defined( 'AUTOMOTIVE_CHARGING_STATION_TEXT' ) ) {
define( 'AUTOMOTIVE_CHARGING_STATION_TEXT', __( 'Automotive Charging Station Pro','automotive-charging-station' ));
}
if ( ! defined( 'AUTOMOTIVE_CHARGING_STATION_BUY_TEXT' ) ) {
define( 'AUTOMOTIVE_CHARGING_STATION_BUY_TEXT', __( 'Upgrade Pro','automotive-charging-station' ));
}
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( AUTOMOTIVE_CHARGING_STATION_TEXT,'automotive-charging-station' ),
'priority' => 0,
'button_text' => __( 'GET PREMIUM', 'automotive-charging-station' ),
'button_url' => esc_url( AUTOMOBILE_HUB_PRO_THEME_URL )
] )
);
} );
function automotive_charging_station_customize_register( $wp_customize ) {
// Pro Version
class automotive_charging_station_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( AUTOMOTIVE_CHARGING_STATION_BUY_TEXT,'automotive-charging-station' ) .'';
echo '';
}
}
// Custom Controls
function automotive_charging_station_sanitize_custom_control( $input ) {
return $input;
}
// Register the custom control type.
$wp_customize->register_control_type( 'Automotive_Charging_Station_Toggle_Control' );
$wp_customize->add_section( 'automotive_charging_station_featured_car_section' , array(
'title' => __( 'Car Charging Services Settings', 'automotive-charging-station' ),
'panel' => 'automobile_hub_panel_id',
'priority' => 4,
) );
$wp_customize->add_setting( 'automotive_charging_station_featured_car_show_hide', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'automobile_hub_sanitize_checkbox',
) );
$wp_customize->add_control( new Automotive_Charging_Station_Toggle_Control( $wp_customize, 'automotive_charging_station_featured_car_show_hide', array(
'label' => esc_html__( 'Show / Hide section', 'automotive-charging-station' ),
'section' => 'automotive_charging_station_featured_car_section',
'type' => 'toggle',
'settings' => 'automotive_charging_station_featured_car_show_hide',
) ) );
$wp_customize->add_setting('automotive_charging_station_charging_services_section_tittle',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('automotive_charging_station_charging_services_section_tittle',array(
'label' => __('Section Title','automotive-charging-station'),
'section' => 'automotive_charging_station_featured_car_section',
'type' => 'text'
));
$wp_customize->selective_refresh->add_partial( 'automotive_charging_station_charging_services_section_tittle', array(
'selector' => '#featured-car h2',
'render_callback' => 'automobile_hub_customize_partial_automotive_charging_station_charging_services_section_tittle',
) );
$categories = get_categories();
$cats = array();
$i = 0;
$automotive_charging_station_offer_cat[]= 'select';
foreach($categories as $category){
if($i==0){
$default = $category->slug;
$i++;
}
$automotive_charging_station_offer_cat[$category->slug] = $category->name;
}
$wp_customize->add_setting('automotive_charging_station_charging_services_section_category',array(
'default' => 'select',
'sanitize_callback' => 'automobile_hub_sanitize_choices',
));
$wp_customize->add_control('automotive_charging_station_charging_services_section_category',array(
'type' => 'select',
'choices' => $automotive_charging_station_offer_cat,
'label' => __('Select Category','automotive-charging-station'),
'section' => 'automotive_charging_station_featured_car_section',
));
// Pro Version
$wp_customize->add_setting( 'automotive_charging_station_services_pro_version_logo', array(
'sanitize_callback' => 'automotive_charging_station_sanitize_custom_control'
));
$wp_customize->add_control( new automotive_charging_station_Customize_Pro_Version ( $wp_customize,'automotive_charging_station_services_pro_version_logo', array(
'section' => 'automotive_charging_station_featured_car_section',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'automotive-charging-station' ),
'description' => esc_url( AUTOMOBILE_HUB_PRO_THEME_URL ),
'priority' => 10,
)));
}
add_action( 'customize_register', 'automotive_charging_station_customize_register' );