/** * Ottimizzazione LCP Dinamica Unificata e Preload Intelligente * newsauto.live */ if ( ! defined( 'ABSPATH' ) ) { exit; } // 1. Preload dell'immagine LCP (Estrae la sorgente reale con supporto WebP / srcset) add_action( 'wp_head', 'newsauto_preload_perfect_lcp_image', 1 ); function newsauto_preload_perfect_lcp_image() { if ( ( is_front_page() || is_home() || is_page( 324 ) ) && ! is_admin() ) { $latest_posts = get_posts( array( 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'post', ) ); if ( ! empty( $latest_posts ) ) { $latest_post_id = $latest_posts[0]->ID; $thumb_id = get_post_thumbnail_id( $latest_post_id ); if ( $thumb_id ) { // Prende l'immagine originale e l'attributo srcset se generato da WP $img_src = wp_get_attachment_image_url( $thumb_id, 'jannah-image-post' ); $img_srcset = wp_get_attachment_image_srcset( $thumb_id, 'jannah-image-post' ); if ( $img_src ) { if ( $img_srcset ) { // Se sono presenti più taglie (srcset), precarica in modalità adattiva echo '' . "\n"; } else { // Preload standard senza forzare il tipo mime jpeg echo '' . "\n"; } } } } } } // 2. Unificazione del Buffer HTML per LCP e Sezioni Lazy Load add_action( 'template_redirect', 'newsauto_start_unified_home_buffer', 2 ); function newsauto_start_unified_home_buffer() { if ( ( is_front_page() || is_home() || is_page( 324 ) ) && ! is_admin() ) { ob_start( 'newsauto_process_unified_home_html' ); } } function newsauto_process_unified_home_html( $html ) { // A. Gestione LCP sulla prima immagine del contenuto $first_img = true; $html = preg_replace_callback( '/]*?)>/i', function( $matches ) use ( &$first_img ) { if ( $first_img ) { // Esclude logo, avatar o piccole icone if ( preg_match( '/(logo|avatar|icon|badge)/i', $matches[0] ) ) { return $matches[0]; } $first_img = false; $img_code = $matches[0]; // Rimuove loading="lazy" o data-src se iniettati dal tema Jannah $img_code = preg_replace( '/\s*loading=["\']lazy["\']/i', '', $img_code ); $img_code = preg_replace( '/\bclass=["\']([^"\']*)\blazy-img\b([^"\']*)["\']/i', 'class="$1 $2"', $img_code ); // Forza fetchpriority="high" if ( strpos( $img_code, 'fetchpriority' ) === false ) { $img_code = str_replace( ']*?\bclass=["\'][^"\']*\b(container-wrapper|section-item)\b[^"\']*["\'][^>]*?)>/i', function( $matches ) use ( &$section_count ) { $section_count++; if ( $section_count > 2 ) { $attributes = $matches[1]; $attributes = preg_replace( '/class=["\']([^"\']*)["\']/i', 'class="$1 lazy-home-section"', $attributes ); return ''; } return $matches[0]; }, $html ); return $html; } Motorsport: notizie, risultati e approfondimenti sulle Corse Auto

Motorsport

Tutta l’adrenalina del Motorsport in un’unica sezione: notizie, risultati, anteprime e approfondimenti sul mondo delle competizioni automobilistiche. Seguiamo le gare più prestigiose a livello internazionale e nazionale: dai Rally (come WRC e gare su terra), alla Formula 1 E,  Formula 1 (F1) archivio fino al 2024 poi passa su F1.newsauto.live, dalle corse in Pista (Endurance, GT, Turismo) alle Auto Storiche e ai nuovi campionati elettrici. Qui trovi il meglio dell’automobilismo sportivo, con un focus sulle prestazioni delle vetture e sull’abilità dei piloti.