get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'paropakar_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'paropakar_customize_partial_blogdescription', ) ); /** * Custom colors. */ $wp_customize->add_setting( 'colorscheme', array( 'default' => 'light', 'transport' => 'postMessage', 'sanitize_callback' => 'paropakar_sanitize_colorscheme', ) ); $wp_customize->add_setting( 'colorscheme_hue', array( 'default' => 250, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', // The hue is stored as a positive integer. ) ); $wp_customize->add_control( 'colorscheme', array( 'type' => 'radio', 'label' => __( 'Color Scheme', 'paropakar' ), 'choices' => array( 'light' => __( 'Light', 'paropakar' ), 'dark' => __( 'Dark', 'paropakar' ), 'custom' => __( 'Custom', 'paropakar' ), ), 'section' => 'colors', 'priority' => 5, ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'colorscheme_hue', array( 'mode' => 'hue', 'section' => 'colors', 'priority' => 6, ) ) ); /** * Theme options. */ $wp_customize->add_section( 'theme_options', array( 'title' => __( 'Theme Options', 'paropakar' ), 'priority' => 130, // Before Additional CSS. ) ); $wp_customize->add_setting( 'page_layout', array( 'default' => 'two-column', 'sanitize_callback' => 'paropakar_sanitize_page_layout', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'page_layout', array( 'label' => __( 'Page Layout', 'paropakar' ), 'section' => 'theme_options', 'type' => 'radio', 'description' => __( 'When the two-column layout is assigned, the page title is in one column and content is in the other.', 'paropakar' ), 'choices' => array( 'one-column' => __( 'One Column', 'paropakar' ), 'two-column' => __( 'Two Column', 'paropakar' ), ), 'active_callback' => 'paropakar_is_view_with_layout_option', ) ); /** * Filter number of front page sections in Paropakar theme. * * @since Paropakar theme 1.0 * * @param int $num_sections Number of front page sections. */ $num_sections = apply_filters( 'paropakar_front_page_sections', 4 ); // Create a setting and control for each of the sections available in the theme. for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { $wp_customize->add_setting( 'panel_' . $i, array( 'default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( 'panel_' . $i, array( /* translators: %d is the front page section number */ 'label' => sprintf( __( 'Front Page Section %d Content', 'paropakar' ), $i ), 'description' => ( 1 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'paropakar' ) ), 'section' => 'theme_options', 'type' => 'dropdown-pages', 'allow_addition' => true, 'active_callback' => 'paropakar_is_static_front_page', ) ); $wp_customize->selective_refresh->add_partial( 'panel_' . $i, array( 'selector' => '#panel' . $i, 'render_callback' => 'paropakar_front_page_section', 'container_inclusive' => true, ) ); } } add_action( 'customize_register', 'paropakar_customize_register' ); /** * Sanitize the page layout options. * * @param string $input Page layout. */ function paropakar_sanitize_page_layout( $input ) { $valid = array( 'one-column' => __( 'One Column', 'paropakar' ), 'two-column' => __( 'Two Column', 'paropakar' ), ); if ( array_key_exists( $input, $valid ) ) { return $input; } return ''; } /** * Sanitize the colorscheme. * * @param string $input Color scheme. */ function paropakar_sanitize_colorscheme( $input ) { $valid = array( 'light', 'dark', 'custom' ); if ( in_array( $input, $valid, true ) ) { return $input; } return 'light'; } /** * Render the site title for the selective refresh partial. * * @since Paropakar theme 1.0 * @see paropakar_customize_register() * * @return void */ function paropakar_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @since Paropakar theme 1.0 * @see paropakar_customize_register() * * @return void */ function paropakar_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Return whether we're previewing the front page and it's a static page. */ function paropakar_is_static_front_page() { return ( is_front_page() && ! is_home() ); } /** * Return whether we're on a view that supports a one or two column layout. */ function paropakar_is_view_with_layout_option() { // This option is available on all pages. It's also available on archives when there isn't a sidebar. return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) ); } /** * Paropakar Theme Customizer */ function paropakar_theme_customizer( $wp_customize ) { $wp_customize->add_panel( 'paropakar_theme_options', array( 'priority' => 30, 'theme_supports' => '', 'title' => __('Paropakar Theme Options', 'paropakar'), 'description' => __('Several settings of Paropakar Theme', 'paropakar'), ) ); /** * Paropakar Header Image Slider */ $wp_customize->add_section( "paropakar_img_slider", array( "title" => __("Header Image Slider", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( 'paropakar_slider_activation', array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_checkbox", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_activation', array( "label" => __('Check to turn on image slider ( If unchecked, header background image will be shown.)', "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_activation', "type" => "checkbox", ) ) ) ; for ( $i = 1 ; $i <= 4 ; $i++ ) { $wp_customize->add_setting( 'paropakar_slider_title_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_title_'.$i, array( "label" => __('Slider Title '.$i, "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_title_'.$i, "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_slider_sub_title_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_sub_title_'.$i, array( "label" => __('Slider Sub Title '.$i, "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_sub_title_'.$i, "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_slider_description_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_description_'.$i, array( "label" => __( 'Slider Description '.$i, "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_description_'.$i, "type" => "textarea", ) ) ) ; $wp_customize->add_setting( 'paropakar_slider_btn_name_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_btn_name_'.$i, array( "label" => __('Slider Button Name '.$i, "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_btn_name_'.$i, "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_slider_link_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_slider_link_'.$i, array( 'label' => __( 'Slider Button Link '.$i, 'paropakar' ), 'section' => 'paropakar_img_slider', 'settings' => 'paropakar_slider_link_'.$i, 'type' => 'url', ) ) ); $wp_customize->add_setting( 'paropakar_slider_image_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_file", ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'paropakar_slider_image_'.$i, array( "label" => __('Slider Image '.$i, "paropakar"), "section" => "paropakar_img_slider", "settings" => 'paropakar_slider_image_'.$i, ) ) ) ; } /** * Paropakar Client Testimonial Slider */ $wp_customize->add_section( "paropakar_client_testimonial", array( "title" => __("Client Testimonial", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ) ; $wp_customize->add_setting( 'paropakar_client_testimonial_heading', array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_client_testimonial_heading', array( "label" => __('Client Testimonial Heading', "paropakar"), "section" => "paropakar_client_testimonial", "settings" => 'paropakar_client_testimonial_heading', "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_client_testimonial_desc', array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_client_testimonial_desc', array( "label" => __( 'Client Testimonial Description', "paropakar"), "section" => "paropakar_client_testimonial", "settings" => 'paropakar_client_testimonial_desc', "type" => "textarea", ) ) ) ; for ( $i = 1 ; $i <= 6 ; $i++ ) { $wp_customize->add_setting( 'paropakar_client_name_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_client_name_'.$i, array( "label" => __('Client Name '.$i, "paropakar"), "section" => "paropakar_client_testimonial", "settings" => 'paropakar_client_name_'.$i, "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_client_testimony_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_client_testimony_'.$i, array( "label" => __('Client Testimony '.$i, "paropakar"), "section" => "paropakar_client_testimonial", "settings" => 'paropakar_client_testimony_'.$i, "type" => "textarea", ) ) ) ; $wp_customize->add_setting( 'paropakar_client_image_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_file", ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'paropakar_client_image_'.$i, array( "label" => __('Client Image '.$i, "paropakar"), "section" => "paropakar_client_testimonial", "settings" => 'paropakar_client_image_'.$i, ) ) ) ; } /** * Paropakar Header Background Image */ $wp_customize->add_setting( "paropakar_header_img", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_file", ) ); $wp_customize->add_section( "paropakar_header_img_upload", array( "title" => __("Header Background Image", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ) ; $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'paropakar_header_img', array( 'label' => __( 'Upload Header Background Image', 'paropakar' ), 'section' => 'paropakar_header_img_upload', 'settings' => 'paropakar_header_img' ) ) ) ; /** * Paropakar Donation */ $wp_customize->add_section( "paropakar_donation", array( "title" => __("Donations", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( "paropakar_donation_main_title", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_donation_main_title", array( "label" => __("Donation Main Title", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_donation_main_title", "type" => "text", ) ) ) ; $wp_customize->add_setting( "paropakar_donation_main_desc", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_donation_main_desc", array( "label" => __("Donation Main Description", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_donation_main_desc", "type" => "textarea", ) ) ) ; $wp_customize->add_setting( "paropakar_donation_btn_name", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_donation_btn_name", array( "label" => __("Donation Button Name", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_donation_btn_name", "type" => "text", ) ) ) ; $wp_customize->add_setting( "paropakar_donation_btn_link", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_donation_btn_link", array( "label" => __("Donation Button Link", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_donation_btn_link", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_volunteer_btn_name", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_volunteer_btn_name", array( "label" => __("Volunteer Button Name", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_volunteer_btn_name", "type" => "text", ) ) ) ; $wp_customize->add_setting( "paropakar_volunteer_btn_link", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_volunteer_btn_link", array( "label" => __("Volunteer Button Link", "paropakar"), "section" => "paropakar_donation", "settings" => "paropakar_volunteer_btn_link", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_donation_img", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_file", ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'paropakar_donation_img', array( 'label' => __( 'Upload Donation Background Image', 'paropakar' ), 'section' => 'paropakar_donation', 'settings' => 'paropakar_donation_img', 'panel' => 'paropakar_theme_options' ) ) ) ; /** * Paropakar Services */ $wp_customize->add_section( "paropakar_services", array( "title" => __("Services", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( "paropakar_services_main_title", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_services_main_title", array( "label" => __("Services Main Title", "paropakar"), "section" => "paropakar_services", "settings" => "paropakar_services_main_title", "type" => "text", ) ) ) ; $wp_customize->add_setting( 'paropakar_services_main_desc', array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_services_main_desc', array( "label" => __('Services Main Description', "paropakar"), "section" => "paropakar_services", "settings" => 'paropakar_services_main_desc', "type" => "textarea", ) ) ) ; $wp_customize->add_setting( "paropakar_services_btn_name", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_services_btn_name", array( "label" => __("Services Button Name", "paropakar"), "section" => "paropakar_services", "settings" => "paropakar_services_btn_name", "type" => "text", ) ) ) ; $wp_customize->add_setting( "paropakar_services_btn_link", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_services_btn_link", array( "label" => __("Services Button Link", "paropakar"), "section" => "paropakar_services", "settings" => "paropakar_services_btn_link", "type" => "url", ) ) ) ; for ( $i = 1 ; $i <= 6 ; $i++ ) { $wp_customize->add_setting( 'paropakar_services_content_icon_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_services_content_icon_'.$i, array( 'label' => __( 'Services Content Icon '.$i, 'paropakar' ), 'section' => 'paropakar_services', 'settings' => 'paropakar_services_content_icon_'.$i, ) ) ); $wp_customize->add_setting( 'paropakar_services_content_description_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "wp_filter_nohtml_kses", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_services_content_description_'.$i, array( "label" => __( 'Services Content Description '.$i, "paropakar"), "section" => "paropakar_services", "settings" => 'paropakar_services_content_description_'.$i, "type" => "textarea", ) ) ) ; } /** * Side-Bar Option Customization */ $wp_customize->add_section( "paropakar_sidebar_option", array( "title" => __("Sidebar Option", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( "paropakar_sidebar_option", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_radio", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_sidebar_option", array( "label" => __("Choose your sidebar option", "paropakar"), "section" => "paropakar_sidebar_option", "settings" => "paropakar_sidebar_option", "type" => "radio", 'choices' => array( 'null' => __( 'Without Sidebar', 'paropakar' ), 'left' => __( 'Left Sidebar', 'paropakar' ), 'right' => __( 'Right Sidebar', 'paropakar' ), ), ) ) ) ; /** * Social Link Options **/ $wp_customize->add_section( "links", array( "title" => __("Social Links", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( 'paropakar_show_social_icons', array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_checkbox", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_show_social_icons', array( "label" => __('Check to turn on social icons', "paropakar"), "section" => "links", "settings" => 'paropakar_show_social_icons', "type" => "checkbox", ) ) ) ; $wp_customize->add_setting( "paropakar_facebook", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_facebook", array( "label" => __("Facebook", "paropakar"), "section" => "links", "settings" => "paropakar_facebook", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_twitter", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_twitter", array( "label" => __("Twitter", "paropakar"), "section" => "links", "settings" => "paropakar_twitter", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_plus_google", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_plus_google", array( "label" => __("Google+", "paropakar"), "section" => "links", "settings" => "paropakar_plus_google", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_youtube", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_youtube", array( "label" => __("YouTube", "paropakar"), "section" => "links", "settings" => "paropakar_youtube", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_linkedin", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_linkedin", array( "label" => __("LinkedIn", "paropakar"), "section" => "links", "settings" => "paropakar_linkedin", "type" => "url", ) ) ) ; $wp_customize->add_setting( "paropakar_instagram", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "esc_url_raw", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "paropakar_instagram", array( "label" => __("Instagram", "paropakar"), "section" => "links", "settings" => "paropakar_instagram", "type" => "url", ) ) ) ; /** * Paropakar Footer Options **/ $wp_customize->add_section( "paropakar_footer", array( "title" => __("Footer Options", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); $wp_customize->add_setting( "paropakar_to_the_top", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_checkbox", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_to_the_top', array( "label" => __('Check to turn on to the top option', "paropakar"), "section" => "paropakar_footer", "settings" => 'paropakar_to_the_top', "type" => "checkbox", ) ) ) ; $wp_customize->add_setting( "paropakar_show_footer_copyright", array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_checkbox", ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'paropakar_show_footer_copyright', array( "label" => __('Check to show copyright link', "paropakar"), "section" => "paropakar_footer", "settings" => 'paropakar_show_footer_copyright', "type" => "checkbox", ) ) ) ; /** * Paropakar Footer Client Logo Slider **/ $wp_customize->add_section( "paropakar_client_logo_slider", array( "title" => __("Client Logo Slider", "paropakar"), "priority" => 30, 'panel' => 'paropakar_theme_options', ) ); for ( $i = 1 ; $i <= 7 ; $i++ ) { $wp_customize->add_setting( 'paropakar_client_logo_'.$i, array( "default" => "", "transport" => "postMessage", "sanitize_callback" => "paropakar_sanitize_file" ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'paropakar_client_logo_'.$i, array( "label" => __('Client Logo '.$i, "paropakar"), "section" => "paropakar_client_logo_slider", "settings" => 'paropakar_client_logo_'.$i, ) ) ) ; } } add_action( 'customize_register', 'paropakar_theme_customizer' ) ; /** * Bind JS handlers to instantly live-preview changes. */ function paropakar_customize_preview_js() { wp_enqueue_script( 'paropakar-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview' ), '1.0', true ); } add_action( 'customize_preview_init', 'paropakar_customize_preview_js' ); /** * Load dynamic logic for the customizer controls area. */ function paropakar_panels_js() { wp_enqueue_script( 'paropakar-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '1.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'paropakar_panels_js' ); /** * Sanitization Functions */ function paropakar_sanitize_checkbox( $checked ){ // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function paropakar_sanitize_radio( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } //file input sanitization function function paropakar_sanitize_file( $file, $setting ) { //allowed file types $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png' ); //check file type from file name $file_ext = wp_check_filetype( $file, $mimes ); //if file has a valid mime type return it, otherwise return default return ( $file_ext['ext'] ? $file : $setting->default ); }