'ffffff',
'default-image' => '',
)));
if ( ! defined( 'COFFEE_TEA_DEMO_IMPORT_URL' ) ) {
define( 'COFFEE_TEA_DEMO_IMPORT_URL', esc_url( admin_url( 'themes.php?page=cafecoffeecharm-wizard' ) ) );
}
if ( ! defined( 'COFFEE_TEA_WELCOME_MESSAGE' ) ) {
define( 'COFFEE_TEA_WELCOME_MESSAGE', __( 'Welcome! Thank you for choosing Cafe Coffee Charm', 'cafe-coffee-charm' ) );
}
if ( ! defined( 'COFFEE_TEA_DEMO_IMPORT_URL' ) ) {
define( 'COFFEE_TEA_DEMO_IMPORT_URL', esc_url( admin_url( 'themes.php?page=cafecoffeecharm-wizard' ) ) );
}
}
endif;
add_action('after_setup_theme', 'cafe_coffee_charm_setup');
// Set content width
function cafe_coffee_charm_content_width() {
$GLOBALS['content_width'] = apply_filters('cafe_coffee_charm_content_width', 1170);
}
add_action('after_setup_theme', 'cafe_coffee_charm_content_width', 0);
// Register widget areas
function cafe_coffee_charm_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar Widget Area', 'cafe-coffee-charm'),
'id' => 'coffee-tea-sidebar-primary',
'description' => __('The Primary Widget Area', 'cafe-coffee-charm'),
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => __('Footer Widget Area', 'cafe-coffee-charm'),
'id' => 'coffee-tea-footer-widget-area',
'description' => __('The Footer Widget Area', 'cafe-coffee-charm'),
'before_widget' => '',
'before_title' => '',
));
}
add_action('widgets_init', 'cafe_coffee_charm_widgets_init');
// Remove customizer settings
function cafe_coffee_charm_remove_custom($wp_customize) {
$wp_customize->remove_setting('coffee_tea_slider4');
$wp_customize->remove_control('coffee_tea_slider4');
$wp_customize->remove_setting('coffee_tea_slider5');
$wp_customize->remove_control('coffee_tea_slider5');
$wp_customize->remove_section('coffee_tea_product_section');
}
add_action('customize_register', 'cafe_coffee_charm_remove_custom', 1000);
function cafe_coffee_charm_child_customize_register( $wp_customize ) {
/*=========================================
product Section
=========================================*/
$wp_customize->add_section(
'cafe_coffee_charm_our_products_section', array(
'title' => esc_html__( 'Best Selling Products Section', 'cafe-coffee-charm' ),
'priority' => 13,
'panel' => 'coffee_tea_frontpage_sections',
)
);
// About Us Hide/ Show Setting //
$wp_customize->add_setting(
'cafe_coffee_charm_our_products_show_hide_section' ,
array(
'default' => false,
'sanitize_callback' => 'coffee_tea_sanitize_checkbox',
'capability' => 'edit_theme_options',
'priority' => 2,
)
);
$wp_customize->add_control(
'cafe_coffee_charm_our_products_show_hide_section',
array(
'label' => esc_html__( 'Hide / Show Section', 'cafe-coffee-charm' ),
'section' => 'cafe_coffee_charm_our_products_section',
'settings' => 'cafe_coffee_charm_our_products_show_hide_section',
'type' => 'checkbox'
)
);
$wp_customize->add_setting(
'cafe_coffee_charm_category_small_heading',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'cafe_coffee_charm_category_small_heading',
array(
'label' => __('Add Short Heading','cafe-coffee-charm'),
'section' => 'cafe_coffee_charm_our_products_section',
'type' => 'text',
)
);
// About Heading
$wp_customize->add_setting(
'cafe_coffee_charm_product_heading',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'cafe_coffee_charm_product_heading',
array(
'label' => __('Add Heading','cafe-coffee-charm'),
'section' => 'cafe_coffee_charm_our_products_section',
'type' => 'text',
)
);
$cafe_coffee_charm_args = array(
'type' => 'product',
'child_of' => 0,
'parent' => '',
'orderby' => 'term_group',
'order' => 'ASC',
'hide_empty' => false,
'hierarchical' => 1,
'number' => '',
'taxonomy' => 'product_cat',
'pad_counts' => false
);
$categories = get_categories($cafe_coffee_charm_args);
$cafe_coffee_charm_cats = array();
$i = 0;
foreach ($categories as $category) {
if ($i == 0) {
$default = $category->slug;
$i++;
}
$cafe_coffee_charm_cats[$category->slug] = $category->name;
}
// Set the default value to "none"
$cafe_coffee_charm_default_value = 'product_cat8';
$wp_customize->add_setting(
'cafe_coffee_charm_our_product_product_category',
array(
'default' => $cafe_coffee_charm_default_value,
'sanitize_callback' => 'coffee_tea_sanitize_select',
)
);
// Add "None" as an option in the select dropdown
$cafe_coffee_charm_cats_with_none = array_merge(array('none' => 'None'), $cafe_coffee_charm_cats);
$wp_customize->add_control(
'cafe_coffee_charm_our_product_product_category',
array(
'type' => 'select',
'choices' => $cafe_coffee_charm_cats_with_none,
'label' => __('Select Trending Products Category', 'cafe-coffee-charm'),
'section' => 'cafe_coffee_charm_our_products_section',
)
);
}
add_action( 'customize_register', 'cafe_coffee_charm_child_customize_register', 20 );