%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
namespace Layerdrops\Insur;
class Customizer
{
public function __construct()
{
add_action("customize_register", [$this, 'insur_customizer']);
}
public function insur_customizer($wp_customize)
{
// add panel
$wp_customize->add_panel(
'insur_theme_opt',
array(
'title' => esc_html__('Insur Options', 'insur-addon'),
'description' => esc_html__('Insur Theme options panel', 'insur-addon'),
'priority' => 220,
'capability' => 'edit_theme_options',
)
);
// General Settings
$wp_customize->add_section('insur_theme_general', array(
'title' => __('General Settings', 'insur-addon'),
'description' => esc_html__('Insur General Settings.', 'insur-addon'),
'priority' => 10,
'capability' => 'edit_theme_options',
'panel' => 'insur_theme_opt'
));
$this->customize_type_color(
$wp_customize,
esc_html__('Select Theme Primary color', 'insur-addon'),
'insur_theme_general',
'theme_primary_color',
'#0ce0ff'
);
$this->customize_type_color(
$wp_customize,
esc_html__('Select Theme Base color', 'insur-addon'),
'insur_theme_general',
'theme_base_color',
'#015fc9'
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Dark Mode?', 'insur-addon'),
'insur_theme_general',
'insur_dark_mode',
'no',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Boxed Mode?', 'insur-addon'),
'insur_theme_general',
'insur_boxed_mode',
'no',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Custom Cursor', 'insur-addon'),
'insur_theme_general',
'custom_cursor',
'yes',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Back to top?', 'insur-addon'),
'insur_theme_general',
'scroll_to_top',
'yes',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select Back to top icon', 'insur-addon'),
'insur_theme_general',
'scroll_to_top_icon',
'fa-angle-up',
insur_get_fa_icons(),
function () {
return (get_theme_mod('scroll_to_top', 'no') == 'yes' ? true : false);
}
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Preloader?', 'insur-addon'),
'insur_theme_general',
'preloader',
'yes',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_image(
$wp_customize,
esc_html__('Custom Preloader Image', 'insur-addon'),
'insur_theme_general',
'preloader_image',
'',
function () {
return (get_theme_mod('preloader', 'no') == 'yes' ? true : false);
}
);
$this->customize_type_image(
$wp_customize,
esc_html__('Page Header Background Image', 'insur-addon'),
'insur_theme_general',
'page_header_bg_image'
);
$this->customize_type_image(
$wp_customize,
esc_html__('Page Header Shape', 'insur-addon'),
'insur_theme_general',
'page_header_bg_shape'
);
$this->customize_type_image(
$wp_customize,
esc_html__('404 Image', 'insur-addon'),
'insur_theme_general',
'error_page_bg_image'
);
// Blog Layout
$wp_customize->add_section('insur_blog_layout_settings', array(
'title' => __('Blog Layout', 'insur-addon'),
'description' => esc_html__('Insur Blog Layout', 'insur-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'insur_theme_opt'
));
$this->customize_type_select(
$wp_customize,
'Select Sidebar position',
'insur_blog_layout_settings',
'insur_blog_layout',
'right-align',
array(
'left-align' => esc_html__('Left Align', 'insur-addon'),
'right-align' => esc_html__('Right Align', 'insur-addon'),
)
);
// Header options
$wp_customize->add_section('insur_theme_header', array(
'title' => __('Header Settings', 'insur-addon'),
'description' => esc_html__('Insur Header Settings', 'insur-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'insur_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Add Logo size in px', 'insur-addon'),
'insur_theme_header',
'header_logo_width',
esc_html(198)
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Sticky Header?', 'insur-addon'),
'insur_theme_header',
'header_sticky_menu',
'yes',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Breadcrumb?', 'insur-addon'),
'insur_theme_header',
'breadcrumb_opt',
'yes',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Custom Header?', 'insur-addon'),
'insur_theme_header',
'header_custom',
'no',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select Header Type', 'insur-addon'),
'insur_theme_header',
'header_custom_post',
'',
insur_post_query('header'),
function () {
return (get_theme_mod('header_custom', 'no') == 'yes' ? true : false);
}
);
// Mobile Menu
$wp_customize->add_section('insur_theme_mobile_menu', array(
'title' => esc_html__('Mobile Menu Settings', 'insur-addon'),
'description' => esc_html__('Insur Header Settings', 'insur-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'insur_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Mobile Menu Email', 'insur-addon'),
'insur_theme_mobile_menu',
'insur_mobile_menu_email',
esc_html__('needhelp@insur.com', 'insur-addon')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Mobile Menu Phone', 'insur-addon'),
'insur_theme_mobile_menu',
'insur_mobile_menu_phone',
esc_html__('666 888 0000', 'insur-addon')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Facebook url', 'insur-addon'),
'insur_theme_mobile_menu',
'facebook_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Twitter url', 'insur-addon'),
'insur_theme_mobile_menu',
'twitter_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Linkedin url', 'insur-addon'),
'insur_theme_mobile_menu',
'linkedin_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Pinterest url', 'insur-addon'),
'insur_theme_mobile_menu',
'pinterest_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Youtube url', 'insur-addon'),
'insur_theme_mobile_menu',
'youtube_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('dribbble url', 'insur-addon'),
'insur_theme_mobile_menu',
'dribble_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Instagram url', 'insur-addon'),
'insur_theme_mobile_menu',
'instagram_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Reddit url', 'insur-addon'),
'insur_theme_mobile_menu',
'reddit_url',
);
// Footer options
$wp_customize->add_section('insur_theme_footer', array(
'title' => esc_html__('Footer Settings', 'insur-addon'),
'description' => esc_html__('Insur Footer Settings.', 'insur-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'insur_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Footer Text', 'insur-addon'),
'insur_theme_footer',
'footer_copytext',
esc_html__('© All right reserved', 'insur'),
function () {
return (get_theme_mod('footer_custom', 'no') == 'yes' ? false : true);
}
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Custom Footer ?', 'insur-addon'),
'insur_theme_footer',
'footer_custom',
'no',
array(
'yes' => esc_html__('Yes', 'insur-addon'),
'no' => esc_html__('No', 'insur-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select Footer Type', 'insur-addon'),
'insur_theme_footer',
'footer_custom_post',
'',
insur_post_query('footer'),
function () {
return (get_theme_mod('footer_custom', 'no') == 'yes' ? true : false);
}
);
}
//type text
public function customize_type_text($wp_customize, $label, $section_id, $name, $default = "", $callback = null)
{
// add settings
$wp_customize->add_setting($name, array(
'default' => $default,
'type' => 'theme_mod'
));
$wp_customize->add_control(new \WP_Customize_Control(
$wp_customize,
$name,
array(
"label" => $label,
"section" => $section_id,
"settings" => $name,
"type" => "text",
"active_callback" => $callback,
)
));
}
//type color
public function customize_type_color($wp_customize, $label, $section_id, $name, $default)
{
// add settings
$wp_customize->add_setting($name, array(
'default' => sanitize_hex_color($default),
'type' => 'theme_mod'
));
// Add control
$wp_customize->add_control(new \WP_Customize_Color_Control($wp_customize, $name, array(
'label' => $label,
'section' => $section_id,
'setting' => $name,
'priority' => 1
)));
}
// type checkbox
public function customize_type_checkbox($wp_customize, $label, $section_id, $name, $default, $callback = null)
{
$wp_customize->add_setting($name, array(
"default" => $default,
"transport" => "refresh",
));
$wp_customize->add_control(new \WP_Customize_Control(
$wp_customize,
$name,
array(
"label" => $label,
"section" => $section_id,
"settings" => $name,
"type" => "checkbox",
"active_callback" => $callback,
)
));
}
// type Image
public function customize_type_image($wp_customize, $label, $section_id, $name, $default = '', $callback = null)
{
$wp_customize->add_setting($name, array(
"default" => $default,
"transport" => "refresh",
));
$wp_customize->add_control(new \WP_Customize_Upload_Control($wp_customize, $name, array(
'label' => $label,
'section' => $section_id,
'setting' => $name,
'priority' => 20,
"active_callback" => $callback,
)));
}
public function customize_type_select($wp_customize, $label, $section_id, $name, $default, $select_value, $callback = null)
{
$wp_customize->add_setting($name, array(
'default' => $default,
"transport" => "refresh",
));
$wp_customize->add_control(new \WP_Customize_Control(
$wp_customize,
$name,
array(
"label" => $label,
"section" => $section_id,
"settings" => $name,
"type" => "select",
'choices' => $select_value,
"active_callback" => $callback,
)
));
}
public function customize_type_radio($wp_customize, $label, $section_id, $name, $default, $radio_value, $callback = null)
{
$wp_customize->add_setting($name, array(
'default' => $default,
"transport" => "refresh",
));
$wp_customize->add_control(new \WP_Customize_Control(
$wp_customize,
$name,
array(
"label" => $label,
"section" => $section_id,
"settings" => $name,
"type" => "radio",
'choices' => $radio_value,
"active_callback" => $callback,
)
));
}
}
Zerion Mini Shell 1.0