Hero Image Optimization #85
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements comprehensive image optimization for the home page hero block, introducing responsive image sizes and lazy loading controls to improve page load performance. The changes add WordPress responsive image generation with multiple size variations specifically tailored for hero display, while implementing conditional lazy loading that disables it for above-the-fold hero images to optimize Largest Contentful Paint (LCP) metrics. The implementation follows WordPress best practices by leveraging the native
wp_get_attachment_image()function with custom size attributes and loading parameters configured through ACF block fields.Hero Block Image Optimization:
app/setup.phpwith multiple breakpoint-specific dimensions for hero imagesHeroBlock.phpto include a newdisable_lazy_loadfield allowing editors to control lazy loading behavior per-blockwp_get_attachment_image()with propersizesattribute and conditionalloadingparameter based on the lazy load settingPerformance and Core Web Vitals:
loading="eager"option for hero images to prevent lazy loading on above-the-fold content, directly improving LCP scoressizesattribute with responsive breakpoints to ensure browsers download appropriately-sized images for each viewportDocumentation:
Files Changed:
CHANGELOG.md(Modified)app/Blocks/HeroBlock.php(Modified)app/setup.php(Modified)resources/views/blocks/hero-block.blade.php(Modified)style.css(Modified)