a3rev / a3-lazy-load

Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
GNU General Public License v3.0
18 stars 11 forks source link

Lazy loading images programmatically #5

Closed galbaras closed 6 years ago

galbaras commented 7 years ago

I have images embedded by PHP code in the theme. Is there a public function or filter I can use to make them lazy load?

Is there a developer guide for this plugin somewhere?

alextuan commented 6 years ago

@galbaras you can call apply_filters for 'a3_lazy_load_html' tag from your PHP code in the theme so that our plugin can filter and apply Lazy Load to your content

For example:

$include_noscript = true; // true|false
$your_html = apply_filters( 'a3_lazy_load_html', $your_html, $include_noscript );
petermyo commented 6 years ago

Hi alextuan

Can we use this apply filter in the iframe?

alextuan commented 6 years ago

@petermyo yes, you can use that to apply for iframe, it apply for images, videos, iframes