diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index 758c6782f..c2788dfe9 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -27,7 +27,7 @@ * Actions and filters. */ add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' ); -add_filter( 'wp_get_attachment_image_attributes', __NAMESPACE__ . '\eager_load_first_card_row_images', 10, 3 ); +add_filter( 'wp_get_attachment_image_attributes', __NAMESPACE__ . '\eager_load_first_card_rows_images', 10, 3 ); add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' ); add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\maybe_enqueue_sensei_assets', 100 ); @@ -139,20 +139,20 @@ function enqueue_assets() { } /** - * Eagerly load the images for the first row of cards, for performance (LCP metric). + * Eagerly load the images for the first 2 rows of cards, for performance (LCP metric). * * @param array $attr The image attributes. * @param WP_Post $attachment The attachment post object. * @param string $size The image size. * @return array The modified image attributes. */ -function eager_load_first_card_row_images( $attr, $attachment, $size ) { +function eager_load_first_card_rows_images( $attr, $attachment, $size ) { static $image_count = 0; if ( is_front_page() || is_archive() || is_search() || is_page( 'my-courses' ) ) { $image_count++; - if ( $image_count <= 3 ) { + if ( $image_count <= 6 ) { $attr['loading'] = 'eager'; $attr['fetchpriority'] = 'high'; }