Current File : /home/pacjaorg/www/grants -mzee/wp-content/themes/wihelp/inc/class-customize.php |
<?php
if (!defined('ABSPATH')) {
exit;
}
if (!class_exists('WiHelp_Customize')) {
class WiHelp_Customize {
public function __construct() {
add_action('customize_register', array($this, 'customize_register'));
}
/**
* @param $wp_customize WP_Customize_Manager
*/
public function customize_register($wp_customize) {
/**
* Theme options.
*/
require_once get_theme_file_path('inc/customize-control/editor.php');
$this->init_wihelp_blog($wp_customize);
$this->init_wihelp_social($wp_customize);
if (wihelp_is_woocommerce_activated()) {
$this->init_woocommerce($wp_customize);
}
do_action('wihelp_customize_register', $wp_customize);
}
/**
* @param $wp_customize WP_Customize_Manager
*
* @return void
*/
public function init_wihelp_blog($wp_customize) {
$wp_customize->add_section('wihelp_blog_archive', array(
'title' => esc_html__('Blog', 'wihelp'),
));
// =========================================
// Select Style
// =========================================
$wp_customize->add_setting('wihelp_options_blog_style', array(
'type' => 'option',
'default' => 'standard',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_blog_style', array(
'section' => 'wihelp_blog_archive',
'label' => esc_html__('Blog style', 'wihelp'),
'type' => 'select',
'choices' => array(
'standard' => esc_html__('Blog Standard', 'wihelp'),
//====start_premium
'style-1' => esc_html__('Blog Grid', 'wihelp'),
//====end_premium
),
));
$wp_customize->add_setting('wihelp_options_blog_columns', array(
'type' => 'option',
'default' => 1,
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_blog_columns', array(
'section' => 'wihelp_blog_archive',
'label' => esc_html__('Colunms', 'wihelp'),
'type' => 'select',
'choices' => array(
1 => esc_html__('1', 'wihelp'),
2 => esc_html__('2', 'wihelp'),
3 => esc_html__('3', 'wihelp'),
4 => esc_html__('4', 'wihelp'),
),
));
$wp_customize->add_setting('wihelp_options_blog_archive_sidebar', array(
'type' => 'option',
'default' => 'right',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_blog_archive_sidebar', array(
'section' => 'wihelp_blog_archive',
'label' => esc_html__('Sidebar Position', 'wihelp'),
'type' => 'select',
'choices' => array(
'left' => esc_html__('Left', 'wihelp'),
'right' => esc_html__('Right', 'wihelp'),
),
));
}
/**
* @param $wp_customize WP_Customize_Manager
*
* @return void
*/
public function init_wihelp_social($wp_customize) {
$wp_customize->add_section('wihelp_social', array(
'title' => esc_html__('Socials', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Show Social Share', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_facebook', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_facebook', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Facebook', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_twitter', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_twitter', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Twitter', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_linkedin', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_linkedin', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Linkedin', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_google-plus', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_google-plus', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Google+', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_pinterest', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_pinterest', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Pinterest', 'wihelp'),
));
$wp_customize->add_setting('wihelp_options_social_share_email', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_social_share_email', array(
'type' => 'checkbox',
'section' => 'wihelp_social',
'label' => esc_html__('Share on Email', 'wihelp'),
));
}
/**
* @param $wp_customize WP_Customize_Manager
*
* @return void
*/
public function init_woocommerce($wp_customize) {
$wp_customize->add_panel('woocommerce', array(
'title' => esc_html__('Woocommerce', 'wihelp'),
));
$wp_customize->add_section('wihelp_woocommerce_archive', array(
'title' => esc_html__('Archive', 'wihelp'),
'capability' => 'edit_theme_options',
'panel' => 'woocommerce',
'priority' => 1,
));
$wp_customize->add_setting('wihelp_options_woocommerce_archive_layout', array(
'type' => 'option',
'default' => 'default',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_woocommerce_archive_layout', array(
'section' => 'wihelp_woocommerce_archive',
'label' => esc_html__('Layout Style', 'wihelp'),
'type' => 'select',
'choices' => array(
'default' => esc_html__('Sidebar', 'wihelp'),
//====start_premium
'canvas' => esc_html__('Canvas Filter', 'wihelp'),
'dropdown' => esc_html__('Dropdown Filter', 'wihelp'),
//====end_premium
),
));
$wp_customize->add_setting('wihelp_options_woocommerce_archive_sidebar', array(
'type' => 'option',
'default' => 'left',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_woocommerce_archive_sidebar', array(
'section' => 'wihelp_woocommerce_archive',
'label' => esc_html__('Sidebar Position', 'wihelp'),
'type' => 'select',
'choices' => array(
'left' => esc_html__('Left', 'wihelp'),
'right' => esc_html__('Right', 'wihelp'),
),
));
// =========================================
// Single Product
// =========================================
$wp_customize->add_section('wihelp_woocommerce_single', array(
'title' => esc_html__('Single Product', 'wihelp'),
'capability' => 'edit_theme_options',
'panel' => 'woocommerce',
));
$wp_customize->add_setting('wihelp_options_single_product_gallery_layout', array(
'type' => 'option',
'default' => 'horizontal',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_single_product_gallery_layout', array(
'section' => 'wihelp_woocommerce_single',
'label' => esc_html__('Style', 'wihelp'),
'type' => 'select',
'choices' => array(
'horizontal' => esc_html__('Horizontal', 'wihelp'),
'vertical' => esc_html__('Vertical', 'wihelp'),
),
));
$wp_customize->add_setting('wihelp_options_single_product_content_meta', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wihelp_sanitize_editor',
));
$wp_customize->add_control(new WiHelp_Customize_Control_Editor($wp_customize, 'wihelp_options_single_product_content_meta', array(
'section' => 'wihelp_woocommerce_single',
'label' => esc_html__('Single extra description', 'wihelp'),
)));
$wp_customize->add_setting('wihelp_options_single_product_archive_sidebar', array(
'type' => 'option',
'default' => 'left',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_single_product_archive_sidebar', array(
'section' => 'wihelp_woocommerce_single',
'label' => esc_html__('Sidebar Position', 'wihelp'),
'type' => 'select',
'choices' => array(
'left' => esc_html__('Left', 'wihelp'),
'right' => esc_html__('Right', 'wihelp'),
),
));
// =========================================
// Product
// =========================================
$wp_customize->add_section('wihelp_woocommerce_product', array(
'title' => esc_html__('Product Block', 'wihelp'),
'capability' => 'edit_theme_options',
'panel' => 'woocommerce',
));
$wp_customize->add_setting('wihelp_options_wocommerce_block_style', array(
'type' => 'option',
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_wocommerce_block_style', array(
'section' => 'wihelp_woocommerce_product',
'label' => esc_html__('Style', 'wihelp'),
'type' => 'select',
'choices' => array(
'' => esc_html__('Style 1', 'wihelp'),
),
));
$wp_customize->add_setting('wihelp_options_woocommerce_product_hover', array(
'type' => 'option',
'default' => 'none',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_woocommerce_product_hover', array(
'section' => 'wihelp_woocommerce_product',
'label' => esc_html__('Animation Image Hover', 'wihelp'),
'type' => 'select',
'choices' => array(
'none' => esc_html__('None', 'wihelp'),
'bottom-to-top' => esc_html__('Bottom to Top', 'wihelp'),
'top-to-bottom' => esc_html__('Top to Bottom', 'wihelp'),
'right-to-left' => esc_html__('Right to Left', 'wihelp'),
'left-to-right' => esc_html__('Left to Right', 'wihelp'),
'swap' => esc_html__('Swap', 'wihelp'),
'fade' => esc_html__('Fade', 'wihelp'),
'zoom-in' => esc_html__('Zoom In', 'wihelp'),
'zoom-out' => esc_html__('Zoom Out', 'wihelp'),
),
));
$wp_customize->add_setting('wihelp_options_wocommerce_row_laptop', array(
'type' => 'option',
'default' => 3,
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_wocommerce_row_laptop', array(
'section' => 'woocommerce_product_catalog',
'label' => esc_html__('Products per row Laptop', 'wihelp'),
'type' => 'number',
));
$wp_customize->add_setting('wihelp_options_wocommerce_row_tablet', array(
'type' => 'option',
'default' => 2,
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_wocommerce_row_tablet', array(
'section' => 'woocommerce_product_catalog',
'label' => esc_html__('Products per row tablet', 'wihelp'),
'type' => 'number',
));
$wp_customize->add_setting('wihelp_options_wocommerce_row_mobile', array(
'type' => 'option',
'default' => 1,
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('wihelp_options_wocommerce_row_mobile', array(
'section' => 'woocommerce_product_catalog',
'label' => esc_html__('Products per row mobile', 'wihelp'),
'type' => 'number',
));
}
}
}
return new WiHelp_Customize();