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 ); } } /** * Sanitize our Google Font variants * */ function shesha_sanitize_variants( $input ) { if ( is_array( $input ) ) { $input = implode( ',', $input ); } return sanitize_text_field( $input ); } add_action( 'customize_controls_enqueue_scripts', 'shesha_do_control_inline_scripts', 100 ); /** * Add misc inline scripts to our controls. * * We don't want to add these to the controls themselves, as they will be repeated * each time the control is initialized. * */ function shesha_do_control_inline_scripts() { wp_localize_script( 'shesha-typography-customizer', 'shesha_customize', array( 'nonce' => wp_create_nonce( 'shesha_customize_nonce' ) ) ); wp_localize_script( 'shesha-typography-customizer', 'typography_defaults', shesha_typography_default_fonts() ); } /** * Check to see if we have a logo or not. * * Used as an active callback. Calling has_custom_logo creates a PHP notice for * multisite users. *.1 */ function shesha_has_custom_logo_callback() { if ( get_theme_mod( 'custom_logo' ) ) { return true; } return false; }