Change listing images from lazy loading to eager

Is there a PHP snippet that can be used to change listing images from lazy loading to eager loading? I’ve tried plugins but they don’t seem to effect any HivePress images.

Unfortunately, it’s not possible via a third-party plugin because the listing images are defined with plain HTML in the HivePress template parts, removing the lazy attribute would require overriding the template parts via a child theme.

Is there any other solution for this, as I’m using the HivePress plugin with a third party theme?

Even if there’s a third-party theme, you can still override the HivePress template parts (e.g. via a child theme), please check this tutorial Customizing Templates I HivePress Developer Docs - YouTube
For example, you can override the /plugins/hivepress/templates/listing/view/block/listing-image.php and /plugins/hivepress/templates/listing/view/page/listing-images.php template parts if required with a child theme.

Does HivePress offer a service that I can pay for to have one of your developers change the lazy attribute?

We temporarily don’t offer such services, but if you’re familiar with customization basics I can provide some guidance (or if you hire a freelancer via Fiverr or Upwork). It’s pretty easy, you can just create a child theme, copy template parts to it and remove the “lazy” attribute from the HTML content of these files.
Also, please share the use-case of this - lazy loading seems to be good for page speed and SEO, if we’re missing some use-cases we may add this option to HivePress.

Some guidance would be great. I saw that the child theme plugin referenced in the video you sent over is no longer available.

Lazy loading is great for any images that aren’t above the fold but can negatively effect a page’s largest contentful paint for those that are.

Here’s a note per Google’s PageSpeed Insights:

“Above-the-fold images that are lazily loaded render later in the page lifecycle, which can delay the largest contentful paint.”

Please try using this one Generate Child Theme – WordPress plugin |

Then you can follow the overriding template parts instructions from this screencast Customizing Templates I HivePress Developer Docs - YouTube to override the /listing/view/page/listing-images.php and /listing/view/block/listing-image.php files.

I highly recommend keeping the lazy loading attribute, e.g. WordPress itself recently started adding this attribute to all the images (like featured post images) by default, loading images by default may delay the page rendering.

Thanks. Will the above method work with a third party theme?

Yes, it’ll work with any theme. If you’re integrating a third-party theme with HivePress this tutorial may also be useful Integrate your theme with HivePress - Developer Docs

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.