-
Notifications
You must be signed in to change notification settings - Fork 0
lazyZ33/cls-elementor-image-carousel-missing-attribute
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The core concept behind the provided PHP code is safe, targeted HTML modification to fix this Cumulative Layout Shift (CLS) on Elementor's Image Carousel: * Image elements do not have explicit width and height Since Elementor often omits the necessary `width` and `height` attributes on the `<img>` tags, this PHP filter hooks into the WordPress image generation process (`wp_get_attachment_image`) to inject them. Crucially, it limits its scope by using a three-part check: * It only runs for images containing the unique carousel class (`swiper-slide-image`). * It ensures the attributes are **missing** before inserting them. * It verifies that valid intrinsic dimensions exist in the database. This ensures the fix applies only to the problem images without breaking other elements or conflicting with existing code.
About
Fix CLS in Elementor Image Carousels by adding missing width and height to images via PHP, improving visual stability without affecting other elements.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published