about_callout_section( $wp_customize ); $this->sidebar_callout_section( $wp_customize ); $this->footer_callout_section( $wp_customize ); $this->social_callout_section( $wp_customize ); $this->colours_callout_section( $wp_customize ); } /* Sanitize Inputs */ public function sanitize_custom_option($input) { return ( $input === "No" ) ? "No" : "Yes"; } public function sanitize_custom_text($input) { return filter_var($input, FILTER_SANITIZE_STRING); } public function sanitize_about_header($input) { return $input; } public function sanitize_about_text($input) { return $input; } public function sanitize_custom_url($input) { return filter_var($input, FILTER_SANITIZE_URL); } public function sanitize_custom_email($input) { return filter_var($input, FILTER_SANITIZE_EMAIL); } public function sanitize_hex_color( $color ) { if ( '' === $color ) { return ''; } // 3 or 6 hex digits, or the empty string. if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { return $color; } } /* Show sidebar */ private function sidebar_callout_section( $wp_customize ) { // $wp_customize->add_section('blogtime-sidebar-callout-section', array( 'title' => 'Sidebar', 'priority' => 3, 'description' => __('Sidebar is only displayed on the Blog page.', 'blogtime'), )); $wp_customize->add_setting('blogtime-sidebar-callout-display', array( 'default' => 'No', 'sanitize_callback' => array( $this, 'sanitize_custom_option' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-sidebar-callout-display-control', array( 'label' => 'Display sidebar?', 'section' => 'blogtime-sidebar-callout-section', 'settings' => 'blogtime-sidebar-callout-display', 'type' => 'select', 'choices' => array('No' => 'No', 'Yes' => 'Yes') ))); // } /* About Section */ private function about_callout_section( $wp_customize ) { // New panel for "Layout". $wp_customize->add_section('blogtime-about-callout-section', array( 'title' => 'About', 'priority' => 2, 'description' => __('The About section is only displayed on the Blog page.', 'blogtime'), )); $wp_customize->add_setting('blogtime-about-callout-display', array( 'default' => 'No', 'sanitize_callback' => array( $this, 'sanitize_custom_option' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-about-callout-display-control', array( 'label' => 'Display this section?', 'section' => 'blogtime-about-callout-section', 'settings' => 'blogtime-about-callout-display', 'type' => 'select', 'choices' => array('No' => 'No', 'Yes' => 'Yes') ))); $wp_customize->add_setting('blogtime-about-callout-header', array( 'default' => 'About blog', 'sanitize_callback' => array( $this, 'sanitize_about_header' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-about-callout-header-control', array( 'label' => 'About header', 'section' => 'blogtime-about-callout-section', 'settings' => 'blogtime-about-callout-header', 'type' => 'text' ))); $wp_customize->add_setting('blogtime-about-callout-text', array( 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_about_text' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-about-callout-control', array( 'label' => 'About content', 'section' => 'blogtime-about-callout-section', 'settings' => 'blogtime-about-callout-text', 'type' => 'textarea' ))); $wp_customize->add_setting('blogtime-about-callout-image', array( 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => array( $this, 'sanitize_custom_url' ) )); $wp_customize->add_control(new WP_Customize_Cropped_Image_Control($wp_customize, 'blogtime-about-callout-image-control', array( 'label' => 'Image', 'section' => 'blogtime-about-callout-section', 'settings' => 'blogtime-about-callout-image', 'width' => 542, 'height' => 310 ))); } /* Footer Section */ private function footer_callout_section( $wp_customize ) { $wp_customize->add_section('blogtime-footer-callout-section', array( 'title' => 'Footer', 'priority' => 4, )); $wp_customize->add_setting('blogtime-footer-callout-display', array( 'default' => 'No', 'sanitize_callback' => array( $this, 'sanitize_custom_option' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-footer-callout-display-control', array( 'label' => 'Display Policy section?', 'section' => 'blogtime-footer-callout-section', 'settings' => 'blogtime-footer-callout-display', 'type' => 'select', 'choices' => array('No' => 'No', 'Yes' => 'Yes'), ))); $wp_customize->add_setting('blogtime-footer-callout-privacy-policy', array( 'default' => '/privacy', 'sanitize_callback' => array( $this, 'sanitize_custom_url' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-footer-callout-privacy-control', array( 'label' => 'Privacy Policy URL', 'section' => 'blogtime-footer-callout-section', 'settings' => 'blogtime-footer-callout-privacy-policy', 'description' => 'You can add custom URL for your Privacy page. Default is set to /privacy', ))); $wp_customize->add_setting('blogtime-footer-callout-cookie-policy', array( 'default' => '/cookie-policy', 'sanitize_callback' => array( $this, 'sanitize_custom_url' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-footer-callout-cookie-control', array( 'label' => 'Privacy Policy URL', 'section' => 'blogtime-footer-callout-section', 'settings' => 'blogtime-footer-callout-cookie-policy', 'description' => 'You can add custom URL for your Cookie Policy page. Default is set to /cookie-policy', ))); $wp_customize->add_setting('blogtime-footer-callout-copyright', array( 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_custom_text' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blogtime-footer-callout-control', array( 'label' => 'Copyright', 'section' => 'blogtime-footer-callout-section', 'settings' => 'blogtime-footer-callout-copyright', 'type' => 'textarea' ))); } /* Social Section */ private function social_callout_section( $wp_customize ) { $wp_customize->add_section('basic-social-callout-section', array( 'title' => 'Social', 'priority' => 3, 'description' => __('Leave blank if you dont want a social network to be displayed.', 'blogtime'), )); $wp_customize->add_setting('basic-social-callout-display', array( 'default' => 'No', 'sanitize_callback' => array( $this, 'sanitize_custom_option' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'basic-social-callout-display-control', array( 'label' => 'Display this section?', 'section' => 'basic-social-callout-section', 'settings' => 'basic-social-callout-display', 'type' => 'select', 'choices' => array('No' => 'No', 'Yes' => 'Yes'), ))); /* MailChimp */ $wp_customize->add_setting('basic-social-callout-mailchimp', array( 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_custom_url' ) )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'basic-social-callout-control-mailchimp', array( 'label' => 'MailChimp URL', 'section' => 'basic-social-callout-section', 'settings' => 'basic-social-callout-mailchimp', 'description' => __(' Adding MailChimp Username will create the Subscribe functionality for you. How to get your MailChimp Form ID: Login to Mailchimp. Naviage to Audience and then click on "Add a pop-up form". Create a "Embedded form" and untick everything except Show only required fields. At this point the link that you need to copy will appear in the Copy/paste section. Find the html tag that starts with