File: /var/www/html/wp-content/themes/university-education-hub/customizer/customizer.php
<?php
function university_education_hub_remove_customize_register() {
global $wp_customize;
$wp_customize->remove_setting( 'elearning_education_show_slider_content' );
$wp_customize->remove_control( 'elearning_education_show_slider_content' );
$wp_customize->remove_setting( 'elearning_education_login_button' );
$wp_customize->remove_control( 'elearning_education_login_button' );
$wp_customize->remove_setting( 'elearning_education_login_button_link' );
$wp_customize->remove_control( 'elearning_education_login_button_link' );
$wp_customize->remove_setting( 'elearning_education_header_teacher' );
$wp_customize->remove_control( 'elearning_education_header_teacher' );
$wp_customize->remove_setting( 'elearning_education_header_wishlist_url' );
$wp_customize->remove_control( 'elearning_education_header_wishlist_url' );
$wp_customize->remove_setting( 'elearning_education_tp_footer_bg_color_option' );
$wp_customize->remove_control( 'elearning_education_tp_footer_bg_color_option' );
$wp_customize->remove_setting( 'elearning_education_footer_widget_image' );
$wp_customize->remove_control( 'elearning_education_footer_widget_image' );
$wp_customize->remove_setting( 'elearning_education_slider_content_layout' );
$wp_customize->remove_control( 'elearning_education_slider_content_layout' );
$wp_customize->remove_setting( 'elearning_education_slider_top' );
$wp_customize->remove_control( 'elearning_education_slider_top' );
}
add_action( 'customize_register', 'university_education_hub_remove_customize_register', 11 );
if ( ! defined( 'UNIVERSITY_EDUCATION_HUB_TEXT' ) ) {
define( 'UNIVERSITY_EDUCATION_HUB_TEXT', __( 'University Education Hub Pro','university-education-hub' ));
}
if ( ! defined( 'UNIVERSITY_EDUCATION_HUB_BUY_TEXT' ) ) {
define( 'UNIVERSITY_EDUCATION_HUB_BUY_TEXT', __( 'Upgrade Pro','university-education-hub' ));
}
add_action( 'customize_register', function( $manager ) {
// Load custom sections.
load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );
$manager->register_section_type( elearning_education_Button::class );
$manager->add_section(
new elearning_education_Button( $manager, 'elearning_education_pro', [
'title' => esc_html( UNIVERSITY_EDUCATION_HUB_TEXT,'university-education-hub' ),
'priority' => 0,
'button_text' => __( 'GET PREMIUM', 'university-education-hub' ),
'button_url' => esc_url( ELEARNING_EDUCATION_PRO_THEME_URL )
] )
);
} );
function university_education_hub_customize_register( $wp_customize ) {
// Pro Version
class University_Education_Hub_Customize_Pro_Version extends WP_Customize_Control {
public $type = 'pro_options';
public function render_content() {
echo '<span>Unlock Premium <strong>'. esc_html( $this->label ) .'</strong>? </span>';
echo '<a href="'. esc_url($this->description) .'" target="_blank">';
echo '<span class="dashicons dashicons-info"></span>';
echo '<strong> '. esc_html( UNIVERSITY_EDUCATION_HUB_BUY_TEXT,'university-education-hub' ) .'<strong></a>';
echo '</a>';
}
}
// Custom Controls
function university_education_hub_sanitize_custom_control( $input ) {
return $input;
}
// Register the custom control type.
$wp_customize->register_control_type( 'University_Education_Hub_Toggle_Control' );
$wp_customize->add_setting('university_education_hub_slider_content_layout',array(
'default' => 'LEFT-ALIGN',
'sanitize_callback' => 'elearning_education_sanitize_choices'
));
$wp_customize->add_control('university_education_hub_slider_content_layout',array(
'type' => 'radio',
'label' => __('Slider Content Layout', 'university-education-hub'),
'section' => 'elearning_education_slider_section',
'choices' => array(
'LEFT-ALIGN' => __('LEFT-ALIGN','university-education-hub'),
'CENTER-ALIGN' => __('CENTER-ALIGN','university-education-hub'),
'RIGHT-ALIGN' => __('RIGHT-ALIGN','university-education-hub'),
),
) );
// Services Section
$wp_customize->add_section( 'university_education_hub_category_section' , array(
'title' => __( 'Services Section Settings', 'university-education-hub' ),
'priority' => 17,
'panel' => 'elearning_education_panel_id'
) );
$wp_customize->add_setting( 'university_education_hub_service_enable', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'elearning_education_sanitize_checkbox',
) );
$wp_customize->add_control( new University_Education_Hub_Toggle_Control( $wp_customize, 'university_education_hub_service_enable', array(
'label' => esc_html__( 'Show / Hide section', 'university-education-hub' ),
'section' => 'university_education_hub_category_section',
'type' => 'toggle',
'settings' => 'university_education_hub_service_enable',
) ) );
for ($i=1; $i <= 3 ; $i++) {
$wp_customize->add_setting('university_education_hub_services_box_icon'.$i,array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('university_education_hub_services_box_icon'.$i,array(
'label' => esc_html__('Icon ','university-education-hub').$i,
'description' => esc_html__('Ex: fab fa-500px','university-education-hub'),
'section' => 'university_education_hub_category_section',
'type' => 'text'
));
$wp_customize->add_setting('university_education_hub_services_box_title'.$i,array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('university_education_hub_services_box_title'.$i,array(
'label' => esc_html__('Title ','university-education-hub').$i,
'section' => 'university_education_hub_category_section',
'type' => 'text'
));
}
// Pro Version
$wp_customize->add_setting( 'university_education_hub_services_pro_version_logo', array(
'sanitize_callback' => 'university_education_hub_sanitize_custom_control'
));
$wp_customize->add_control( new University_Education_Hub_Customize_Pro_Version ( $wp_customize,'university_education_hub_services_pro_version_logo', array(
'section' => 'university_education_hub_category_section',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'university-education-hub' ),
'description' => esc_url( ELEARNING_EDUCATION_PRO_THEME_URL ),
'priority' => 10,
)));
}
add_action( 'customize_register', 'university_education_hub_customize_register' );