File: /home/retoti4c1e1s/www/izzlongevity.com/wp-content/plugins/noile-addon/includes/Customizer.php
<?php
namespace Layerdrops\Noile;
class Customizer
{
public function __construct()
{
add_action("customize_register", [$this, 'noile_customizer']);
}
public function noile_customizer($wp_customize)
{
// add panel
$wp_customize->add_panel(
'noile_theme_opt',
array(
'title' => esc_html__('Noile Options', 'noile-addon'),
'description' => esc_html__('Noile Theme options panel', 'noile-addon'),
'priority' => 220,
'capability' => 'edit_theme_options',
)
);
// General Settings
$wp_customize->add_section('noile_theme_general', array(
'title' => __('General Settings', 'noile-addon'),
'description' => esc_html__('Noile General Settings.', 'noile-addon'),
'priority' => 10,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Dark Mode?', 'noile-addon'),
'noile_theme_general',
'noile_dark_mode',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Boxed Mode?', 'noile-addon'),
'noile_theme_general',
'noile_boxed_mode',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Rtl Mode?', 'noile-addon'),
'noile_theme_general',
'noile_rtl_mode',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Custom Cursor', 'noile-addon'),
'noile_theme_general',
'custom_cursor',
'yes',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Back to top?', 'noile-addon'),
'noile_theme_general',
'scroll_to_top',
'yes',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
// $this->customize_type_select(
// $wp_customize,
// esc_html__('Select Back to top icon', 'noile-addon'),
// 'noile_theme_general',
// 'scroll_to_top_icon',
// 'fa-angle-up',
// noile_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?', 'noile-addon'),
'noile_theme_general',
'preloader',
'yes',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_image(
$wp_customize,
esc_html__('Custom Preloader Image', 'noile-addon'),
'noile_theme_general',
'preloader_image',
'',
function () {
return (get_theme_mod('preloader', 'no') == 'yes' ? true : false);
}
);
$this->customize_type_text(
$wp_customize,
esc_html__('Page Header Text', 'noile-addon'),
'noile_theme_general',
'noile_header_text',
esc_html__('Web Development & Consulting', 'noile-addon')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Page Header Cirlce Text', 'noile-addon'),
'noile_theme_general',
'noile_header_circle_text',
esc_html__('. design for your digital products', 'noile-addon')
);
$this->customize_type_image(
$wp_customize,
esc_html__('Page Header Image', 'noile-addon'),
'noile_theme_general',
'page_header_bg_image'
);
$this->customize_type_image(
$wp_customize,
esc_html__('Page Header Shape One', 'noile-addon'),
'noile_theme_general',
'page_header_shape_one'
);
// Color Settings
$wp_customize->add_section('noile_theme_color', array(
'title' => __('Color Settings', 'noile-addon'),
'description' => esc_html__('Noile Color Settings.', 'noile-addon'),
'priority' => 10,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
noile_source_color_meta('set_customizer', $wp_customize, $this);
// Blog Layout
$wp_customize->add_section('noile_blog_layout_settings', array(
'title' => __('Blog Layout', 'noile-addon'),
'description' => esc_html__('Noile Blog Layout', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_select(
$wp_customize,
'Select Sidebar position',
'noile_blog_layout_settings',
'noile_blog_layout',
'right-align',
array(
'left-align' => esc_html__('Left Align', 'noile-addon'),
'right-align' => esc_html__('Right Align', 'noile-addon'),
'full-width' => esc_html__('Full Width', 'noile-addon'),
)
);
// Shop Layout
$wp_customize->add_section('noile_shop_layout_settings', array(
'title' => __('Shop Layout', 'noile-addon'),
'description' => esc_html__('noile Shop Layout', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_select(
$wp_customize,
'Select Shop Column',
'noile_shop_layout_settings',
'noile_shop_column',
'3',
array(
'2' => esc_html__('2 Column', 'noile-addon'),
'3' => esc_html__('3 Column', 'noile-addon'),
'4' => esc_html__('4 Column', 'noile-addon'),
)
);
$this->customize_type_select(
$wp_customize,
'Select Shop Sidebar position',
'noile_shop_layout_settings',
'noile_shop_layout',
'left-align',
array(
'left-align' => esc_html__('Left Align', 'noile-addon'),
'right-align' => esc_html__('Right Align', 'noile-addon'),
'full-width' => esc_html__('Full Width', 'noile-addon'),
)
);
$this->customize_type_text(
$wp_customize,
esc_html__('Shop Product Per page', 'noile-addon'),
'noile_shop_layout_settings',
'product_per_page',
esc_html(12)
);
// Header options
$wp_customize->add_section('noile_theme_header', array(
'title' => __('Header Settings', 'noile-addon'),
'description' => esc_html__('Noile Header Settings', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Add Logo size in px', 'noile-addon'),
'noile_theme_header',
'header_logo_width',
esc_html(198)
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Sticky Header?', 'noile-addon'),
'noile_theme_header',
'header_sticky_menu',
'yes',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__(' Enable Breadcrumb?', 'noile-addon'),
'noile_theme_header',
'breadcrumb_opt',
'yes',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Custom Header?', 'noile-addon'),
'noile_theme_header',
'header_custom',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select Header Type', 'noile-addon'),
'noile_theme_header',
'header_custom_post',
'',
noile_post_query('header'),
function () {
return (get_theme_mod('header_custom', 'no') == 'yes' ? true : false);
}
);
// Mobile Menu
$wp_customize->add_section('noile_theme_mobile_menu', array(
'title' => esc_html__('Mobile Menu Settings', 'noile-addon'),
'description' => esc_html__('Noile Header Settings', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Mobile Menu Email', 'noile-addon'),
'noile_theme_mobile_menu',
'noile_mobile_menu_email',
esc_html__('needhelp@noile.com', 'noile-addon')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Mobile Menu Phone', 'noile-addon'),
'noile_theme_mobile_menu',
'noile_mobile_menu_phone',
esc_html__('666 888 0000', 'noile-addon')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Facebook url', 'noile-addon'),
'noile_theme_mobile_menu',
'facebook_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Twitter url', 'noile-addon'),
'noile_theme_mobile_menu',
'twitter_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Linkedin url', 'noile-addon'),
'noile_theme_mobile_menu',
'linkedin_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Pinterest url', 'noile-addon'),
'noile_theme_mobile_menu',
'pinterest_url',
esc_html('#')
);
$this->customize_type_text(
$wp_customize,
esc_html__('Youtube url', 'noile-addon'),
'noile_theme_mobile_menu',
'youtube_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('dribbble url', 'noile-addon'),
'noile_theme_mobile_menu',
'dribble_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Instagram url', 'noile-addon'),
'noile_theme_mobile_menu',
'instagram_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Reddit url', 'noile-addon'),
'noile_theme_mobile_menu',
'reddit_url',
);
// Footer options
$wp_customize->add_section('noile_theme_footer', array(
'title' => esc_html__('Footer Settings', 'noile-addon'),
'description' => esc_html__('Noile Footer Settings.', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Footer Text', 'noile-addon'),
'noile_theme_footer',
'footer_copytext',
esc_html__('© All right reserved', 'noile'),
function () {
return (get_theme_mod('footer_custom', 'no') == 'yes' ? false : true);
}
);
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Custom Footer ?', 'noile-addon'),
'noile_theme_footer',
'footer_custom',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select Footer Type', 'noile-addon'),
'noile_theme_footer',
'footer_custom_post',
'',
noile_post_query('footer'),
function () {
return (get_theme_mod('footer_custom', 'no') == 'yes' ? true : false);
}
);
// register
$wp_customize->add_section('noile_login_settings', array(
'title' => __('Login/Register Settings', 'noile-addon'),
'description' => esc_html__('Login/Register Settings', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_text(
$wp_customize,
esc_html__('Redirect url After Login', 'noile-addon'),
'noile_login_settings',
'login_redirect_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Redirect url After Registration', 'noile-addon'),
'noile_login_settings',
'registration_redirect_url',
);
$this->customize_type_text(
$wp_customize,
esc_html__('Redirect url After Log Out', 'noile-addon'),
'noile_login_settings',
'logout_redirect_url',
);
// error page
$wp_customize->add_section('noile_error_page_settings', array(
'title' => __('404 Settings', 'noile-addon'),
'description' => esc_html__('Change 404 Text', 'noile-addon'),
'priority' => 20,
'capability' => 'edit_theme_options',
'panel' => 'noile_theme_opt'
));
$this->customize_type_radio(
$wp_customize,
esc_html__('Enable Custom 404 ?', 'noile-addon'),
'noile_error_page_settings',
'error_custom',
'no',
array(
'yes' => esc_html__('Yes', 'noile-addon'),
'no' => esc_html__('No', 'noile-addon'),
)
);
$this->customize_type_select(
$wp_customize,
esc_html__('Select 404 Page', 'noile-addon'),
'noile_error_page_settings',
'error_custom_post',
'',
noile_post_query('page'),
function () {
return (get_theme_mod('error_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, $section_id, $name, $default = false)
{
$prefix_name = str_replace("-", "_", $name);
// add settings
$wp_customize->add_setting($prefix_name, array(
'default' => sanitize_hex_color($default),
'type' => 'theme_mod'
));
// Add control
$wp_customize->add_control(new \WP_Customize_Color_Control($wp_customize, $prefix_name, array(
'label' => ucwords(str_replace("-", " ", $name)),
'section' => $section_id,
'setting' => $prefix_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,
)
));
}
}