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 bizzoy_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__('Bizzoy Theme Options', 'bizzoy'), 'description' => '', 'priority' => 3, ) ); require get_template_directory(). '/include/sections/top-header.php'; require get_template_directory(). '/include/sections/slider.php'; require get_template_directory(). '/include/sections/services.php'; require get_template_directory(). '/include/sections/blog.php'; require get_template_directory(). '/include/sections/callout.php'; require get_template_directory(). '/include/sections/footer.php'; $wp_customize->add_section('bizzoy_preloader', array( 'title' => esc_html__('Preloader section', 'bizzoy'), 'description' => '', 'panel' => '', 'priority' => 50 ) ); $wp_customize->add_setting('show_preloader',array( 'default' => true, 'sanitize_callback' => 'bizzoy_sanitize_checkbox', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'show_preloader', array( 'settings' => 'show_preloader', 'section' => 'bizzoy_preloader', 'label' => esc_html__('Show Or Hide Preloader','bizzoy'), 'type' => 'checkbox' )); $wp_customize->add_setting('bizzoy_color_scheme',array( 'default' => esc_html__('#ff5722','bizzoy'), 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize,'bizzoy_color_scheme',array( 'label' => esc_html__('Color Scheme','bizzoy'), 'description' => esc_html__('Change Theme Color','bizzoy'), 'section' => 'colors', 'settings' => 'bizzoy_color_scheme' )) ); } add_action( 'customize_register', 'bizzoy_customize_register' ); function bizzoy_customizer_script() { wp_enqueue_script( 'bizzoy-customizer-script', get_template_directory_uri() .'/assets/js/customizer-scripts.js', array("jquery"),'', true ); wp_enqueue_style( 'fontawesome', get_template_directory_uri() .'/assets/css/font-awesome.css'); wp_enqueue_style( 'bizzoy-customizer-style', get_template_directory_uri() .'/assets/css/customizer-style.css'); } add_action( 'customize_controls_enqueue_scripts', 'bizzoy_customizer_script' ); if( class_exists( 'WP_Customize_Control' ) ): class Bizzoy_Fontawesome_Icon_Chooser extends WP_Customize_Control{ public $type = 'icon'; public function render_content(){ ?>