/home/lnzliplg/www/wp-content/themes/law-firm-attorney/customizer/customizer.php
<?php
function law_firm_attorney_remove_customize_register() {
global $wp_customize;
$wp_customize->remove_section( 'lawyer_hub_social_media' );
$wp_customize->remove_setting( 'lawyer_hub_location_text' );
$wp_customize->remove_control( 'lawyer_hub_location_text' );
$wp_customize->remove_setting( 'lawyer_hub_location_icon' );
$wp_customize->remove_control( 'lawyer_hub_location_icon' );
}
add_action( 'customize_register', 'law_firm_attorney_remove_customize_register', 11 );
if ( ! defined( 'LAW_FIRM_ATTORNEY_TEXT' ) ) {
define( 'LAW_FIRM_ATTORNEY_TEXT', __( 'Law Firm Attorney Pro','law-firm-attorney' ));
}
if ( ! defined( 'LAW_FIRM_ATTORNEY_BUY_TEXT' ) ) {
define( 'LAW_FIRM_ATTORNEY_BUY_TEXT', __( 'Upgrade Pro','law-firm-attorney' ));
}
add_action( 'customize_register', function( $manager ) {
// Load custom sections.
load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );
$manager->register_section_type( lawyer_hub_Button::class );
$manager->add_section(
new lawyer_hub_Button( $manager, 'lawyer_hub_pro', [
'title' => esc_html( LAW_FIRM_ATTORNEY_TEXT,'law-firm-attorney' ),
'priority' => 0,
'button_text' => __( 'GET PREMIUM', 'law-firm-attorney' ),
'button_url' => esc_url( LAWYER_HUB_PRO_THEME_URL )
] )
);
} );
function law_firm_attorney_customize_register( $wp_customize ) {
// Pro Version
class LAW_FIRM_ATTORNEY_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( LAW_FIRM_ATTORNEY_BUY_TEXT,'law-firm-attorney' ) .'<strong></a>';
echo '</a>';
}
}
// Custom Controls
function law_firm_attorney_sanitize_custom_control( $input ) {
return $input;
}
// Register the custom control type.
$wp_customize->register_control_type( 'Law_Firm_Attorney_Toggle_Control' );
// Services
$wp_customize->add_section( 'law_firm_attorney_services', array(
'title' => __( 'Service Section', 'law-firm-attorney' ),
'priority' => 4,
'description' => __( 'Add your law firm services', 'law-firm-attorney' ),
'panel' => 'lawyer_hub_panel_id'
) );
$wp_customize->add_setting( 'law_firm_attorney_services_show_hide', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'lawyer_hub_sanitize_checkbox',
) );
$wp_customize->add_control( new Law_Firm_Attorney_Toggle_Control( $wp_customize, 'law_firm_attorney_services_show_hide', array(
'label' => esc_html__( 'Show / Hide section', 'law-firm-attorney' ),
'section' => 'law_firm_attorney_services',
'type' => 'toggle',
'settings' => 'law_firm_attorney_services_show_hide',
) ) );
$wp_customize->add_setting( 'law_firm_attorney_services_animation', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'lawyer_hub_sanitize_checkbox',
) );
$wp_customize->add_control( new lawyer_hub_Toggle_Control( $wp_customize, 'law_firm_attorney_services_animation', array(
'label' => esc_html__( 'Show / Hide Section Animation', 'law-firm-attorney' ),
'priority' => 1,
'section' => 'law_firm_attorney_services',
'type' => 'toggle',
'settings' => 'law_firm_attorney_services_animation',
) ) );
$wp_customize->add_setting('law_firm_attorney_services_title',array(
'default'=> '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('law_firm_attorney_services_title',array(
'label' => __('Add Section Title','law-firm-attorney'),
'section'=> 'law_firm_attorney_services',
'type'=> 'text'
));
$wp_customize->add_setting('law_firm_attorney_services_text',array(
'default'=> '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('law_firm_attorney_services_text',array(
'label' => __('Add Section Text','law-firm-attorney'),
'section'=> 'law_firm_attorney_services',
'type'=> 'text'
));
$wp_customize->add_setting('law_firm_attorney_services_btn_text',array(
'default'=> '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('law_firm_attorney_services_btn_text',array(
'label' => __('Add Section Button Text','law-firm-attorney'),
'section'=> 'law_firm_attorney_services',
'type'=> 'text'
));
$wp_customize->add_setting('law_firm_attorney_services_btn_url',array(
'default'=> '',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('law_firm_attorney_services_btn_url',array(
'label' => __('Add Section Button URL','law-firm-attorney'),
'section'=> 'law_firm_attorney_services',
'type'=> 'url'
));
$categories = get_categories();
$cats = array();
$i = 0;
$services_cat[]= 'select';
foreach($categories as $category){
if($i==0){
$default = $category->slug;
$i++;
}
$services_cat[$category->slug] = $category->name;
}
$wp_customize->add_setting('law_firm_attorney_services_section_category',array(
'default' => 'select',
'sanitize_callback' => 'law_firm_attorney_sanitize_select',
));
$wp_customize->add_control('law_firm_attorney_services_section_category',array(
'type' => 'select',
'choices' => $services_cat,
'label' => __('Select Category','law-firm-attorney'),
'section' => 'law_firm_attorney_services',
));
$wp_customize->add_setting('law_firm_attorney_slider_top',array(
'default'=> '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('law_firm_attorney_slider_top',array(
'label' => __('Add Slider Top Text','law-firm-attorney'),
'section'=> 'lawyer_hub_slider_section',
'type'=> 'text',
'priority' => 1,
));
// Pro Version
$wp_customize->add_setting( 'law_firm_attorney_services_pro_version_logo', array(
'sanitize_callback' => 'law_firm_attorney_sanitize_custom_control'
));
$wp_customize->add_control( new LAW_FIRM_ATTORNEY_Customize_Pro_Version ( $wp_customize,'law_firm_attorney_services_pro_version_logo', array(
'section' => 'law_firm_attorney_services',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'law-firm-attorney' ),
'description' => esc_url( LAWYER_HUB_PRO_THEME_URL ),
'priority' => 7,
)));
}
add_action( 'customize_register', 'law_firm_attorney_customize_register' );