ID ); if ( is_array( $metadata ) && ! empty( $metadata['width'] ) && ! empty( $metadata['height'] ) ) { if ( empty( $attr['width'] ) ) { $attr['width'] = (int) $metadata['width']; } if ( empty( $attr['height'] ) ) { $attr['height'] = (int) $metadata['height']; } } } if ( empty( $attr['fetchpriority'] ) && ! is_admin() && ! is_feed() ) { static $did_set_high_priority = false; if ( ! $did_set_high_priority && is_singular() ) { $attr['fetchpriority'] = 'high'; $did_set_high_priority = true; } } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_improve_attachment_dimensions', 11, 3 ); /** * ------------------------------------------------------------------------ * Preload critical fonts * ------------------------------------------------------------------------ * * Preloads only the fonts that are needed for initial rendering * (headings + body text). This improves LCP and avoids render delays. */ function zeitfresser_preload_fonts() { ?> get_template_directory_uri(), 'crossorigin' => 'anonymous', ]; } return $urls; }, 10, 2 ); /** * ------------------------------------------------------------------------ * Critical CSS (inline for faster first render) * ------------------------------------------------------------------------ * * We inline only the minimal CSS required for initial layout. * This ensures the page structure renders immediately without * waiting for the full stylesheet. */ function zeitfresser_inline_critical_css() { ?>