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 ); } endif; /** * Drop-down Pages sanitization callback example. * * - Sanitization: dropdown-pages * - Control: dropdown-pages * * Sanitization callback for 'dropdown-pages' type controls. This callback sanitizes `$page_id` * as an absolute integer, and then validates that $input is the ID of a published page. * * @see absint() https://developer.wordpress.org/reference/functions/absint/ * @see get_post_status() https://developer.wordpress.org/reference/functions/get_post_status/ * * @param int $page Page ID. * @param WP_Customize_Setting $setting Setting instance. * @return int|string Page ID if the page is published; otherwise, the setting default. */ function benzile_sanitize_dropdown_pages( $page_id, $setting ) { // Ensure $input is an absolute integer. $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } /** Front Page Section Settings starts **/ $wp_customize->add_panel('frontpage', array( 'title' => esc_html__('Benzile Theme Options', 'benzile'), 'description' => '', 'priority' => 3, ) ); // require get_template_directory(). '/include/sections/top-header.php'; require get_template_directory(). '/inc/theme-options/slider.php'; require get_template_directory(). '/inc/theme-options/feature.php'; require get_template_directory(). '/inc/theme-options/about.php'; require get_template_directory(). '/inc/theme-options/blog.php'; $wp_customize->add_section('benzile_preloader', array( 'title' => __('Preloader section', 'benzile'), 'description' => '', 'panel' => 'frontpage', 'priority' => 50 ) ); $wp_customize->add_setting('benzile_show_preloader',array( 'default' => false, 'sanitize_callback' => 'benzile_sanitize_checkbox', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'benzile_show_preloader', array( 'settings' => 'benzile_show_preloader', 'section' => 'benzile_preloader', 'label' => __('Uncheck To Hide Preloader','benzile'), 'type' => 'checkbox' )); $wp_customize->add_setting('benzile_color_scheme',array( 'default' => __('#2b50f0','benzile'), 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize,'benzile_color_scheme',array( 'label' => __('Color Scheme','benzile'), 'description' => __('Change Theme Color','benzile'), 'section' => 'colors', 'settings' => 'benzile_color_scheme' )) ); } add_action( 'customize_register', 'benzile_customize_register' ); function benzile_customizer_script() { wp_enqueue_script( 'benzile-customizer-script', get_template_directory_uri() .'/assets/js/customizer-scripts.js', array("jquery"),'', true ); wp_enqueue_style( 'flaticon', get_template_directory_uri() .'/assets/css/flaticon.css'); wp_enqueue_style( 'benzile-customizer-style', get_template_directory_uri() .'/assets/css/customizer-style.css'); } add_action( 'customize_controls_enqueue_scripts', 'benzile_customizer_script' ); if( class_exists( 'WP_Customize_Control' ) ): class Benzile_Fontawesome_Icon_Chooser extends WP_Customize_Control{ public $type = 'icon'; public function render_content(){ ?>