__( 'View Documentation', 'cafe-express' ), // 'pro' => __('View PRO version','cafe-express') // // ) ); } add_action( 'customize_controls_enqueue_scripts', 'cafe_express_registers' ); /** * Customizer - Live Preview */ function cafe_express_customizer_live_preview() { wp_enqueue_script( 'cafe-express-theme-customizer', get_template_directory_uri() . '/customizer/customizer.js', array( 'customize-preview' ), rand(), true ); } add_action( 'customize_preview_init', 'cafe_express_customizer_live_preview' ); /** * Customizer - Panels, Sections, Settings & Controls */ function cafe_express_register_theme_customizer( $wp_customize ) { $wp_customize->remove_section('colors'); $wp_customize->remove_section('header_image'); if (class_exists('WP_Customize_Control')) { /* Number Class */ class Customize_Number_Control extends WP_Customize_Control { public $type = 'number'; public function render_content() { ?> add_setting( 'cafe_express_main_color', array( 'default' => '#DBB304', 'sanitize_callback' => 'cafe_express_sanitize_color', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cafe_express_main_color_control', array( 'label' => __('Highlight Color', 'cafe-express' ), 'description' => __('change the highlight color to suit.', 'cafe-express'), 'section' => 'title_tagline', 'settings' => 'cafe_express_main_color', 'priority' => 1, ))); $wp_customize->add_setting( 'cafe_express_logo', array( 'sanitize_callback' => 'cafe_express_sanitize_url' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cafe_express_logo', array( 'label' => __( 'Logo', 'cafe-express' ), 'section' => 'title_tagline', 'settings' => 'cafe_express_logo', 'priority' => 40, ))); /* =============================================== HERO SECTION ================================================*/ $wp_customize->add_section( 'hero_section', array( 'title' => __('Hero Settings', 'cafe-express'), 'description' => __('Options for displaying the hero section on the homepage', 'cafe-express'), 'priority' => $priority++, )); /* Show Hero */ $wp_customize->add_setting( 'hide_hero', array( 'default' => 'false', 'sanitize_callback' => 'cafe_express_sanitize_checkbox', )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hide_hero_control', array( 'label' => __('Hide Hero Section', 'cafe-express'), 'section' => 'hero_section', 'settings' => 'hide_hero', 'type' => 'checkbox', 'priority' => $priority++, ))); /* Background Color */ $wp_customize->add_setting( 'hero_background_color', array( 'default' => '#272727', 'sanitize_callback' => 'cafe_express_sanitize_color', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'hero_background_color_control', array( 'label' => __('Background Color', 'cafe-express' ), 'description' => __('This will be used if no background image.', 'cafe-express'), 'section' => 'hero_section', 'settings' => 'hero_background_color', 'priority' => $priority++, ))); /* Title */ $wp_customize->add_setting('hero_section_title', array( 'default' => __( 'Cafe Express has the best coffee beans from across the world!', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'hero_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'hero_section', 'settings' => 'hero_section_title', 'priority' => $priority++, )); /* Primary Button */ $wp_customize->add_setting('hero_primary_btn_label', array( 'default' => __( 'Features', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'hero_primary_btn_label_control', array( 'label' => __( 'Primary button label', 'cafe-express' ), 'section' => 'hero_section', 'settings' => 'hero_primary_btn_label', 'priority' => $priority++, )); $wp_customize->add_setting('hero_primary_btn_url', array( 'default' => esc_url( home_url( '/' ) ).'#services', 'sanitize_callback' => 'cafe_express_sanitize_url', )); $wp_customize->add_control( 'hero_primary_btn_url_control', array( 'label' => __( 'Primary button link', 'cafe-express' ), 'section' => 'hero_section', 'settings' => 'hero_primary_btn_url', 'priority' => $priority++, )); /* Secondary Button */ $wp_customize->add_setting('hero_secondary_btn_label', array( 'default' => __( 'Meet The Team', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'hero_secondary_btn_label_control', array( 'label' => __( 'Secondary button label', 'cafe-express' ), 'section' => 'hero_section', 'settings' => 'hero_secondary_btn_label', 'priority' => $priority++, )); $wp_customize->add_setting('hero_secondary_btn_url', array( 'default' => esc_url( home_url( '/' ) ).'#team', 'sanitize_callback' => 'cafe_express_sanitize_url', )); $wp_customize->add_control( 'hero_secondary_btn_url_control', array( 'label' => __( 'Secondary button link', 'cafe-express' ), 'section' => 'hero_section', 'settings' => 'hero_secondary_btn_url', 'priority' => $priority++, )); /* =============================================== RECENT POSTS SECTION ================================================*/ $wp_customize->add_section( 'recent_section', array( 'title' => __('Recent Posts Section', 'cafe-express'), 'description' => __('Options for displaying your most recent posts on the homepage', 'cafe-express'), 'priority' => $secPriority++, )); $wp_customize->add_setting('recent_section_title', array( 'default' => __( 'Recent Posts', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'recent_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'recent_section', 'settings' => 'recent_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('recent_section_subtitle', array( 'default' => __( 'Your latest posts displayed inside a nice slider. You can customize what the slider looks like.', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'recent_section_subtitle_control', array( 'label' => __( 'Sub-Title', 'cafe-express' ), 'section' => 'recent_section', 'settings' => 'recent_section_subtitle', 'priority' => $priority++, )); $wp_customize->add_setting('recent_section_amount', array( 'default' => 4, 'sanitize_callback' => 'cafe_express_sanitize_integer', )); $wp_customize->add_control( new Customize_Number_Control( $wp_customize, 'recent_section_amount_control', array( 'label' => __( 'Display post amount', 'cafe-express' ), 'section' => 'recent_section', 'settings' => 'recent_section_amount', 'type' => 'number', 'priority' => $priority++, ))); /* ================================================ STRENGTHS SECTION =================================================*/ $wp_customize->add_section( 'strengths_section', array( 'title' => __('Strengths Section', 'cafe-express'), 'description' => __('Options for displaying the Strengths section on homepage', 'cafe-express'), 'priority' => $secPriority++, )); /* Title */ $wp_customize->add_setting('strengths_section_title', array( 'default' => __( 'Our Strengths', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'strengths_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'strengths_section', 'settings' => 'strengths_section_title', 'priority' => $priority++, )); /* Sub Title */ $wp_customize->add_setting('strengths_section_sub_title', array( 'default' => __( 'Check out how popular our Cafe Express coffees are!', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'strengths_section_sub_title_control', array( 'label' => __( 'Sub Title', 'cafe-express' ), 'section' => 'strengths_section', 'settings' => 'strengths_section_sub_title', 'priority' => $priority++, )); /* Image */ $wp_customize->add_setting( 'strengths_image', array( 'default' => get_template_directory_uri().'/images/coffee-beans.png', 'sanitize_callback' => 'cafe_express_sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'strengths_image_control', array( 'label' => __( 'Image', 'cafe-express' ), 'section' => 'strengths_section', 'settings' => 'strengths_image', 'priority' => $priority++, ))); /* Strengths */ $strengths_list = array( array('1', '80', __('COLOMBIAN BUCARAMANGA', 'cafe-express')), array('2', '46', __('COSTA RICA TARRAZU VALLEY', 'cafe-express')), array('3', '71', __('ETHIOPIAN YIRGACHEFFE', 'cafe-express')), array('4', '26', __('GUATEMALA EL FOGON', 'cafe-express')), array('5', '56', __('MONSOON MALABAR', 'cafe-express')), array('6', '17', __('OLD BROWN JAVA', 'cafe-express')) ); $arraycount = count($strengths_list); for ($s = 0; $s < $arraycount; $s++) { /* Strength Title */ $wp_customize->add_setting('strength_' . $strengths_list[$s][0], array( 'default' => $strengths_list[$s][2], 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'strength_' . $strengths_list[$s][0] . '_control', array( 'label' => '#' . $strengths_list[$s][0] . __(' Strength', 'cafe-express' ), 'section' => 'strengths_section', 'settings' => 'strength_' . $strengths_list[$s][0], 'priority' => $priority++, )); /* Strength Percentage */ $wp_customize->add_setting('strength_' . $strengths_list[$s][0] . '_percent', array( 'default' => $strengths_list[$s][1], 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( new Customize_Number_Control( $wp_customize, 'strength_' . $strengths_list[$s][0] . '_percent_control', array( 'label' => '#' . $strengths_list[$s][0] . __( ' Percentage', 'cafe-express' ), 'section' => 'strengths_section', 'settings' => 'strength_' . $strengths_list[$s][0] . '_percent', 'type' => 'number', 'priority' => $priority++, ))); } // end foreach /* ================================================ SERVICE BLOCK SECTION =================================================*/ if(method_exists('WP_Customize_Manager', 'add_panel')){ /* Homepage Settings Panel */ $wp_customize->add_panel('service_panel', array( 'title' => __('Service Section', 'cafe-express'), 'priority' => $secPriority++, )); } $wp_customize->add_section( 'service_block_section', array( 'title' => __('Services Settings', 'cafe-express'), 'description' => __('Options for displaying Service blocks on homepage', 'cafe-express'), 'panel' => 'service_panel', 'priority' => $priority++, )); /* Title */ $wp_customize->add_setting('service_block_section_title', array( 'default' => __( 'Our Services', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'service_block_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'service_block_section', 'settings' => 'service_block_section_title', 'priority' => $priority++, )); /* Sub Title */ $wp_customize->add_setting('service_block_section_subtitle', array( 'default' => __( 'This is Photoshops version of Lorem Ipsum. Proin gravida', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'service_block_section_subtitle_control', array( 'label' => __( 'Sub-Title', 'cafe-express' ), 'section' => 'service_block_section', 'settings' => 'service_block_section_subtitle', 'priority' => $priority++, )); /* =============================================== CTA SECTION ================================================*/ if(method_exists('WP_Customize_Manager', 'add_panel')){ /* Homepage Settings Panel */ $wp_customize->add_panel('cta_panel', array( 'title' => __('Call To Action Section', 'cafe-express'), 'priority' => $secPriority++, )); } $wp_customize->add_section( 'cta_section', array( 'title' => __('Call To Action Settings', 'cafe-express'), 'description' => __('Options for displaying The Call To Action Bar', 'cafe-express'), 'panel' => 'cta_panel', 'priority' => $priority++, )); $wp_customize->add_setting('cta_section_title', array( 'default' => __( 'COMPETITION', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'cta_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'cta_section', 'settings' => 'cta_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('cta_section_sub_title', array( 'default' => __( 'Win a months supply of coffee!', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'cta_section_sub_title_control', array( 'label' => __( 'Sub Title', 'cafe-express' ), 'section' => 'cta_section', 'settings' => 'cta_section_sub_title', 'priority' => $priority++, )); $wp_customize->add_setting('cta_section_url', array( 'default' => esc_url( home_url( '/' ) ).'#cta', 'sanitize_callback' => 'cafe_express_sanitize_url', )); $wp_customize->add_control( 'cta_section_url_control', array( 'label' => __( 'Web Link', 'cafe-express' ), 'section' => 'cta_section', 'settings' => 'cta_section_url', 'priority' => $priority++, )); $wp_customize->add_setting('cta_section_btn_txt', array( 'default' => __( 'ENTER', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'cta_section_btn_txt_control', array( 'label' => __( 'Button Text', 'cafe-express' ), 'section' => 'cta_section', 'settings' => 'cta_section_btn_txt', 'priority' => $priority++, )); $wp_customize->add_section( 'cta_bg_section', array( 'title' => __('Background', 'cafe-express'), 'description' => __('Options for controlling the background.', 'cafe-express'), 'panel' => 'cta_panel', 'priority' => $priority++, )); $wp_customize->add_setting( 'cta_bg_section_color', array( 'default' => '#272727', 'sanitize_callback' => 'cafe_express_sanitize_color', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cta_bg_section_color_control', array( 'label' => __('Background Color', 'cafe-express' ), 'description' => __('This will be used if no background image.', 'cafe-express'), 'section' => 'cta_bg_section', 'settings' => 'cta_bg_section_color', 'priority' => $priority++, ))); $wp_customize->add_setting( 'cta_bg_img', array( 'default' => get_stylesheet_directory_uri() . '/images/cta_bg.jpg', 'sanitize_callback' => 'cafe_express_sanitize_url' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cta_bg_img_control', array( 'label' => __( 'Background Image', 'cafe-express' ), 'section' => 'cta_bg_section', 'settings' => 'cta_bg_img', 'priority' => $priority++, ))); /* =========================================== THE TEAM SECTION ============================================*/ if(method_exists('WP_Customize_Manager', 'add_panel')){ /* Homepage Settings Panel */ $wp_customize->add_panel('team_panel', array( 'title' => __('The Team Section', 'cafe-express'), 'priority' => $secPriority++, )); } $wp_customize->add_section( 'the_team_section', array( 'title' => __('The Team Settings', 'cafe-express'), 'description' => __('Options for displaying The Team on homepage', 'cafe-express'), 'panel' => 'team_panel', 'priority' => $priority++, )); $wp_customize->add_setting('the_team_section_title', array( 'default' => __( 'The Team', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'the_team_section_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'the_team_section', 'settings' => 'the_team_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('the_team_section_subtitle', array( 'default' => __( 'Get to know the ones prepping your morning Joe', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'the_team_section_subtitle_control', array( 'label' => __( 'Sub-Title', 'cafe-express' ), 'section' => 'the_team_section', 'settings' => 'the_team_section_subtitle', 'priority' => $priority++, )); $wp_customize->add_setting('the_team_section_hide_dots', array( 'sanitize_callback' => 'cafe_express_sanitize_checkbox', )); $wp_customize->add_control( 'the_team_section_hide_dots_control', array( 'type' => 'checkbox', 'label' => __('Hide Navigation Dots','cafe-express'), 'section' => 'the_team_section', 'settings' => 'the_team_section_hide_dots', 'priority' => $priority++, )); /* =============================================== TESTIMONIALS SECTION ================================================*/ if(method_exists('WP_Customize_Manager', 'add_panel')){ /* Homepage Settings Panel */ $wp_customize->add_panel('testimonials_panel', array( 'title' => __('Testimonials Section', 'cafe-express'), 'priority' => $secPriority++, )); } $wp_customize->add_section( 'testimonials_section', array( 'title' => __('Testimonials Settings', 'cafe-express'), 'description' => __('Options for displaying your testimonials on the homepage', 'cafe-express'), 'panel' => 'testimonials_panel', 'priority' => $priority++, )); $wp_customize->add_setting('testimonials_section_title', array( 'default' => __( 'Latest Posts', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'testimonials_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'testimonials_section', 'settings' => 'testimonials_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('testimonials_section_subtitle', array( 'default' => __( 'Your latest posts displayed inside a nice slider. You can customize what the slider looks like.', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'testimonials_section_subtitle_control', array( 'label' => __( 'Sub-Title', 'cafe-express' ), 'section' => 'testimonials_section', 'settings' => 'testimonials_section_subtitle', 'priority' => $priority++, )); $wp_customize->add_setting( 'testimonials_section_bg', array( 'default' => get_stylesheet_directory_uri() . '/images/testimonial-bg.jpg', 'sanitize_callback' => 'cafe_express_sanitize_url' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'testimonials_section_bg_control', array( 'label' => __( 'Background Image', 'cafe-express' ), 'section' => 'testimonials_section', 'settings' => 'testimonials_section_bg', 'priority' => $priority++, ))); /* =============================================== SIGN UP SECTION ================================================*/ $wp_customize->add_section( 'signup_section', array( 'title' => __('Newsletter Sign Up', 'cafe-express'), 'description' => __('Options for displaying a sign up form on the homepage', 'cafe-express'), 'priority' => $secPriority++, )); $wp_customize->add_setting('signup_show', array( 'default' => true, 'sanitize_callback' => 'cafe_express_sanitize_checkbox', )); $wp_customize->add_control( 'signup_show_control', array( 'type' => 'checkbox', 'label' => __('Show Sign Up Form','cafe-express'), 'section' => 'signup_section', 'settings' => 'signup_show', 'priority' => $priority++, )); $wp_customize->add_setting('signup_title', array( 'default' => __( 'STAY UPTO DATE, JOIN OUR NEWSLETTER', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'signup_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'signup_section', 'settings' => 'signup_title', 'priority' => $priority++, )); $wp_customize->add_setting('signup_disclaimer', array( 'default' => __( 'WE DO NOT SHARE YOUR INFORMATION WITH ANYONE.', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'signup_disclaimer_control', array( 'label' => __( 'Disclaimer Message', 'cafe-express' ), 'section' => 'signup_section', 'settings' => 'signup_disclaimer', 'priority' => $priority++, )); $wp_customize->add_setting('signup_shortcode', array( 'default' => __( 'Paste MailChimp Form Shortcode', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_textarea', )); $wp_customize->add_control( 'signup_shortcode_control', array( 'label' => __( 'MailChimp Form Shortcode', 'cafe-express' ), 'type' => 'textarea', 'section' => 'signup_section', 'settings' => 'signup_shortcode', 'priority' => $priority++, )); /* =========================================== COUNTERS SECTION ============================================*/ $wp_customize->add_section( 'counters_section', array( 'title' => __('Fun Facts Section', 'cafe-express'), 'description' => __('Options for displaying some important numbers on the homepage', 'cafe-express'), 'priority' => $secPriority++, )); $wp_customize->add_setting('odometer_title', array( 'default' => __('Fun Facts', 'cafe-express'), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'odometer_title_control', array( 'label' => __(' Title', 'cafe-express'), 'section' => 'counters_section', 'settings' => 'odometer_title', 'priority' => $priority++, )); $odometer_list = array( array('1', '80', __('Types', 'cafe-express')), array('2', '320', __('Seats', 'cafe-express')), array('3', '3726', __('Monthly Customers', 'cafe-express')), array('4', '15060', __('Cups drank', 'cafe-express')), ); $arraycount = count($odometer_list); for ($x = 0; $x < $arraycount; $x++) { $wp_customize->add_setting('odometer' . $odometer_list[$x][0] . '_number', array( 'default' => $odometer_list[$x][1], 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( new Customize_Number_Control( $wp_customize, 'odometer' . $odometer_list[$x][0] . '_number_control', array( 'label' => '#' . $odometer_list[$x][0] . __( ' Number', 'cafe-express' ), 'section' => 'counters_section', 'settings' => 'odometer' . $odometer_list[$x][0] . '_number', 'type' => 'number', 'priority' => $priority++, ))); $wp_customize->add_setting('odometer' . $odometer_list[$x][0] . '_title', array( 'default' => $odometer_list[$x][2], 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'odometer' . $odometer_list[$x][0] . '_title_control', array( 'label' => '#' . $odometer_list[$x][0] . __(' Title', 'cafe-express'), 'section' => 'counters_section', 'settings' => 'odometer' . $odometer_list[$x][0] . '_title', 'priority' => $priority++, )); } /* =============================================== CONTACT US SECTION ================================================*/ $wp_customize->add_section( 'contact_section', array( 'title' => __('Contact Settings', 'cafe-express'), 'description' => __('Options for displaying the contact form on the homepage', 'cafe-express'), 'priority' => $secPriority++, )); $wp_customize->add_setting('contact_section_hide', array( 'sanitize_callback' => 'cafe_express_sanitize_checkbox', )); $wp_customize->add_control( 'contact_section_hide_control', array( 'type' => 'checkbox', 'label' => __('Hide Contact Form','cafe-express'), 'section' => 'contact_section', 'settings' => 'contact_section_hide', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_title', array( 'default' => __( 'Get in Touch', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'contact_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_shortcode', array( 'default' => __( 'Get in Touch', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'contact_section_title_control', array( 'label' => __( 'Title', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_title', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_subtitle', array( 'default' => __( 'Use this form to get in touch with us.', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'contact_section_subtitle_control', array( 'label' => __( 'Sub-Title', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_subtitle', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_phone', array( 'default' => __( '1.800.321.4567-8', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'contact_section_phone_control', array( 'label' => __( 'Phone', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_phone', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_email', array( 'default' => __( 'SUPPORT@CAFEEXPRESS.COM', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_santitize_email', )); $wp_customize->add_control( 'contact_section_email_control', array( 'label' => __( 'Email', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_email', 'priority' => $priority++, )); $wp_customize->add_setting('contact_section_address', array( 'default' => __( 'SOME STREET, NEW YORK, USA', 'cafe-express' ), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'contact_section_address_control', array( 'label' => __( 'Address', 'cafe-express' ), 'section' => 'contact_section', 'settings' => 'contact_section_address', 'priority' => $priority++, )); /* =============================================== MAP SECTION ================================================*/ $wp_customize->add_section( 'map_section', array( 'title' => __('MAP Settings', 'cafe-express'), 'description' => __('Options for displaying a map on the homepage', 'cafe-express'), 'priority' => $secPriority++, )); $wp_customize->add_setting('map_show', array( 'default' => false, 'sanitize_callback' => 'cafe_express_sanitize_checkbox', )); $wp_customize->add_control( 'map_show_control', array( 'type' => 'checkbox', 'label' => __('Show Map','cafe-express'), 'section' => 'map_section', 'settings' => 'map_show', 'priority' => $priority++, )); $wp_customize->add_setting('map_section_shortcode', array( 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'map_section_shortcode_control', array( 'label' => __( 'Map Shortcode', 'cafe-express' ), 'section' => 'map_section', 'settings' => 'map_section_shortcode', 'priority' => $priority++, )); /* =============================================== FOOTER BAR SECTION ================================================*/ if(method_exists('WP_Customize_Manager', 'add_panel')){ /* Homepage Settings Panel */ $wp_customize->add_panel('footer_panel', array( 'title' => __('Footer Section', 'cafe-express'), 'priority' => $secPriority++, )); } $wp_customize->add_section( 'footer_section', array( 'title' => __('Copyright Settings', 'cafe-express'), 'description' => __('Edit the copyright information', 'cafe-express'), 'panel' => 'footer_panel', 'priority' => $priority++, )); $copyTxt = __('© ', 'cafe-express') . date("Y") . __(' Template Express', 'cafe-express' ); $wp_customize->add_setting('copyright_text', array( 'default' => $copyTxt, 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'copyright_text_control', array( 'label' => __( 'Copyright Text', 'cafe-express' ), 'section' => 'footer_section', 'settings' => 'copyright_text', 'priority' => $priority++, )); $wp_customize->add_section( 'social_section', array( 'title' => __('Social Media Links', 'cafe-express'), 'description' => __('Add your social media accounts', 'cafe-express'), 'panel' => 'footer_panel', 'priority' => $priority++, )); $list_social_channels = array( // 1 'twitter' => __( 'Twitter url', 'cafe-express' ), 'facebook' => __( 'Facebook url', 'cafe-express' ), 'googleplus' => __( 'Google + url', 'cafe-express' ), 'linkedin' => __( 'LinkedIn url', 'cafe-express' ), 'flickr' => __( 'Flickr url', 'cafe-express' ), 'pinterest' => __( 'Pinterest url', 'cafe-express' ), 'youtube' => __( 'YouTube url', 'cafe-express' ), 'vimeo' => __( 'Vimeo url', 'cafe-express' ), 'tumblr' => __( 'Tumblr url', 'cafe-express' ), 'dribble' => __( 'Dribbble url', 'cafe-express' ), 'github' => __( 'Github url', 'cafe-express' ), 'instagram' => __( 'Instagram url', 'cafe-express' ), 'xing' => __( 'Xing url', 'cafe-express'), ); $snDefault = 0; foreach ($list_social_channels as $key => $value) { $wp_customize->add_setting( $key, array( 'sanitize_callback' => 'cafe_express_sanitize_url', )); if( $snDefault < 4 ): $wp_customize->add_setting( $key, array( 'default' => __('#', 'cafe-express'), 'sanitize_callback' => 'cafe_express_sanitize_url', )); else: $wp_customize->add_setting( $key, array( 'sanitize_callback' => 'cafe_express_sanitize_url', )); endif; $wp_customize->add_control( $key, array( 'label' => $value, 'section' => 'social_section', 'type' => 'url', )); $snDefault++; } // ======== Google Font Setup $list_fonts = array(); // 1 $webfonts_array = file( get_template_directory() . '/inc/fonts.json'); $webfonts = implode( '', $webfonts_array ); $list_fonts_decode = json_decode( $webfonts, true ); $priority = 30; foreach ( $list_fonts_decode['items'] as $key => $value ) { $item_family = $list_fonts_decode['items'][$key]['family']; $list_fonts[$item_family] = $item_family; } $wp_customize->add_section( 'google_font_section', array( 'title' => __('Font Settings', 'cafe-express'), 'priority' => $priority++, )); $wp_customize->add_setting( 'header_font', array( 'default' => 'Open Sans', 'description' => __('Ordered by trending', 'cafe-express'), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'header_font_control', array( 'type' => 'select', 'label' => __( 'Header Font', 'cafe-express' ), 'description' => __( 'Ordered by popularity', 'cafe-express'), 'section' => 'google_font_section', 'settings' => 'header_font', 'priority' => $priority++, 'choices' => $list_fonts, )); $wp_customize->add_setting( 'body_font', array( 'default' => 'Open Sans', 'description' => __('Ordered by trending', 'cafe-express'), 'sanitize_callback' => 'cafe_express_sanitize_text', )); $wp_customize->add_control( 'body_font_control', array( 'type' => 'select', 'label' => __( 'Body Font', 'cafe-express' ), 'description' => __( 'Ordered by popularity', 'cafe-express'), 'section' => 'google_font_section', 'settings' => 'body_font', 'priority' => $priority++, 'choices' => $list_fonts, )); // Change default settings $wp_customize->get_section( 'background_image' )->priority = 25; } add_action( 'customize_register', 'cafe_express_register_theme_customizer' ); /* =========================================== SANITIZATION ============================================*/ // Sanitize Email function cafe_express_santitize_email( $input ){ return sanitize_email( $input ); } // Sanitize Text function cafe_express_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } // Sanitize Textarea function cafe_express_sanitize_textarea($input) { global $allowedposttags; $output = wp_kses( $input, $allowedposttags); return $output; } // Sanitize Checkbox function cafe_express_sanitize_checkbox( $input ) { if( $input ): $output = '1'; else: $output = false; endif; return $output; } // Sanitize Numbers function cafe_express_sanitize_integer( $input ) { $value = (int) $input; // Force the value into integer type. return ( 0 < $input ) ? $input : null; } function cafe_express_sanitize_float( $input ) { return floatval( $input ); } // Sanitize Uploads function cafe_express_sanitize_url($input){ return esc_url_raw($input); } // Sanitize Colors function cafe_express_sanitize_color($input){ return maybe_hash_hex_color($input); }