/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 1.0.1
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/*
    Add your custom styles here
*/

function removeGoogleFonts(){
global $wp_styles;
$regex = '/fonts\.googleapis\.com\/css\?family/i';
foreach($wp_styles->registered as $registered) {
if( preg_match($regex, $registered->src) ) {
wp_dequeue_style($registered->handle);
}
}
}
add_action('wp_enqueue_scripts', 'removeGoogleFonts', 999);

function hello_elementor_child_enqueue_scripts() {
	wp_enqueue_style(
		'hello-elementor-child-style',
		get_stylesheet_directory_uri() . '/style.css',
		[
			'hello-elementor-theme-style',
		],
		'1.0.0'
	);
}

//Elementor Google Fonts deaktivieren
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );

add_action( 'wp_enqueue_scripts', 'hello_elementor_child_enqueue_scripts', 20 );

function webp_upload ($existing_mimes) {  
    $existing_mimes['webp'] = 'image/webp';  
    return $existing_mimes;  
}  
add_filter('mime_types', 'webp_upload');

function webp_preview($result, $path){  
    if($result === false){  
        $displayable_image_types = array(IMAGETYPE_WEBP);  
        $info = @getimagesize($path);  
  
        if(emptyempty($info)){  
            $result = false;  
        } elseif(!in_array($info[2], $displayable_image_types)){  
            $result = false;  
        } else{  
            $result = true;  
        }  
    }  
    return $result;  
}  
add_filter('file_is_displayable_image', 'webp_preview', 10, 2); 