remove_setting( 'vw_bakery_topbar_hide_show' ); $wp_customize->remove_control( 'vw_bakery_topbar_hide_show' ); $wp_customize->remove_setting( 'vw_bakery_topbar_padding_top_bottom' ); $wp_customize->remove_control( 'vw_bakery_topbar_padding_top_bottom' ); $wp_customize->remove_setting( 'vw_bakery_search_hide_show' ); $wp_customize->remove_control( 'vw_bakery_search_hide_show' ); $wp_customize->remove_setting( 'vw_bakery_search_font_size' ); $wp_customize->remove_control( 'vw_bakery_search_font_size' ); $wp_customize->remove_setting( 'vw_bakery_location_address_icon' ); $wp_customize->remove_control( 'vw_bakery_location_address_icon' ); $wp_customize->remove_setting( 'vw_bakery_location' ); $wp_customize->remove_control( 'vw_bakery_location' ); $wp_customize->remove_setting( 'vw_bakery_timing_icon' ); $wp_customize->remove_control( 'vw_bakery_timing_icon' ); $wp_customize->remove_setting( 'vw_bakery_opening_text' ); $wp_customize->remove_control( 'vw_bakery_opening_text' ); $wp_customize->remove_setting( 'vw_bakery_opening_time' ); $wp_customize->remove_control( 'vw_bakery_opening_time' ); $wp_customize->remove_setting( 'vw_bakery_contact_link' ); $wp_customize->remove_control( 'vw_bakery_contact_link' ); $wp_customize->remove_setting( 'vw_bakery_cart_icon' ); $wp_customize->remove_control( 'vw_bakery_cart_icon' ); $wp_customize->remove_setting( 'vw_bakery_resp_topbar_hide_show' ); $wp_customize->remove_control( 'vw_bakery_resp_topbar_hide_show' ); $wp_customize->remove_setting( 'vw_bakery_stickyheader_hide_show' ); $wp_customize->remove_control( 'vw_bakery_stickyheader_hide_show' ); $wp_customize->remove_setting( 'vw_bakery_sticky_header' ); $wp_customize->remove_control( 'vw_bakery_sticky_header' ); $wp_customize->remove_setting( 'vw_bakery_sticky_header_padding' ); $wp_customize->remove_control( 'vw_bakery_sticky_header_padding' ); $wp_customize->remove_setting( 'vw_bakery_contact_button_text' ); $wp_customize->remove_control( 'vw_bakery_contact_button_text' ); $wp_customize->remove_setting( 'vw_bakery_slider_button_text' ); $wp_customize->remove_control( 'vw_bakery_slider_button_text' ); $wp_customize->remove_setting( 'vw_bakery_slider_content_hide_show' ); $wp_customize->remove_control( 'vw_bakery_slider_content_hide_show' ); $wp_customize->remove_section( 'vw_bakery_about' ); $wp_customize->remove_section( 'vw_bakery_social_links' ); } add_action( 'customize_register', 'cafe_coffee_shop_customize_register', 11 ); function cafe_coffee_shop_header_style() { if ( get_header_image() ) : $custom_css = " #header{ background-image:url('".esc_url(get_header_image())."'); background-position: center top; background-size: 100%; }"; wp_add_inline_style( 'cafe-coffee-shop-style', $custom_css ); endif; } add_action( 'wp_enqueue_scripts', 'cafe_coffee_shop_header_style' ); function cafe_coffee_shop_scripts() { wp_enqueue_script( 'Custom JS ', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery') ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'cafe_coffee_shop_scripts' ); function cafe_coffee_shop_customizer ( $wp_customize ) { //Slider $wp_customize->add_setting('cafe_coffee_shop_slider_go_btn',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('cafe_coffee_shop_slider_go_btn',array( 'description' => __('GET PRO','cafe-coffee-shop'), 'section'=> 'vw_bakery_slidersettings', 'type'=> 'hidden' )); $wp_customize->add_setting('cafe_coffee_shop_designation_text',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('cafe_coffee_shop_designation_text',array( 'label' => __('Slider Small Text','cafe-coffee-shop'), 'section' => 'vw_bakery_slidersettings', 'type' => 'text' )); //About section $wp_customize->add_section( 'cafe_coffee_shop_about_section' , array( 'title' => __( 'About us Section', 'cafe-coffee-shop' ), 'description' => __('GET PRO','cafe-coffee-shop'), 'priority' => 20, 'panel' => 'vw_bakery_homepage_panel' ) ); $wp_customize->add_setting('cafe_coffee_shop_section_title',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('cafe_coffee_shop_section_title',array( 'label' => __('Add Section Text','cafe-coffee-shop'), 'input_attrs' => array( 'placeholder' => __( 'OUR STORY', 'cafe-coffee-shop' ), ), 'section'=> 'cafe_coffee_shop_about_section', 'type'=> 'text' )); $wp_customize->add_setting( 'cafe_coffee_shop_about_page' , array( 'default' => '', 'sanitize_callback' => 'cafe_coffee_shop_sanitize_dropdown_pages' ) ); $wp_customize->add_control( 'cafe_coffee_shop_about_page' , array( 'label' => __( 'Select About Page', 'cafe-coffee-shop' ), 'section' => 'cafe_coffee_shop_about_section', 'type' => 'dropdown-pages' ) ); $wp_customize->add_setting( 'cafe_coffee_shop_about_excerpt_number', array( 'default' => 50, 'transport' => 'refresh', 'sanitize_callback' => 'cafe_coffee_shop_sanitize_number_range' ) ); $wp_customize->add_control( 'cafe_coffee_shop_about_excerpt_number', array( 'label' => esc_html__( 'About Excerpt length','cafe-coffee-shop' ), 'section' => 'cafe_coffee_shop_about_section', 'type' => 'range', 'settings' => 'cafe_coffee_shop_about_excerpt_number', 'input_attrs' => array( 'step' => 5, 'min' => 0, 'max' => 50, ), ) ); } add_action( 'customize_register', 'cafe_coffee_shop_customizer' ); /** * Enqueue block editor style */ function cafe_coffee_shop_block_editor_styles() { wp_enqueue_style( 'cafe-coffee-shop-block-patterns-style-editor', get_theme_file_uri( '/inc/block-patterns/css/block-editor.css' ), false, '1.0', 'all' ); } add_action( 'enqueue_block_editor_assets', 'cafe_coffee_shop_block_editor_styles' ); function cafe_coffee_shop_sanitize_choices( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } function cafe_coffee_shop_sanitize_select( $input, $setting ){ $input = sanitize_key($input); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function cafe_coffee_shop_sanitize_dropdown_pages( $page_id, $setting ) { $page_id = absint( $page_id ); return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } function cafe_coffee_shop_sanitize_number_range( $number, $setting ) { $number = absint( $number ); $atts = $setting->manager->get_control( $setting->id )->input_attrs; $min = ( isset( $atts['min'] ) ? $atts['min'] : $number ); $max = ( isset( $atts['max'] ) ? $atts['max'] : $number ); $step = ( isset( $atts['step'] ) ? $atts['step'] : 1 ); return ( $min <= $number && $number <= $max && is_int( $number / $step ) ? $number : $setting->default ); } // Customizer Pro load_template( ABSPATH . WPINC . '/class-wp-customize-section.php' ); class Cafe_Coffee_Shop_Customize_Section_Pro extends WP_Customize_Section { public $type = 'cafe-coffee-shop'; public $pro_text = ''; public $pro_url = ''; public function json() { $json = parent::json(); $json['pro_text'] = $this->pro_text; $json['pro_url'] = esc_url( $this->pro_url ); return $json; } protected function render_template() { ?>