Filter to change html output featured image
-
Hi support!
I created a function to add the data-amp-auto-lightbox-disable attribute to disable the lightbox only for the featured image. This attribute is inserted normally in the html in the non-amp version. Is there a filter to work also on amp pages?
Below the created code
// Disable lighthox amp thumbnail post function disable_lightbox_amp($html) { if ( !is_singular() ) { return; // archive or 404 } $disable_lightbox_amp = 'data-amp-auto-lightbox-disable'; $html = substr_replace( $html, $disable_lightbox_amp, -1, 0 ); return $html; } add_filter( 'post_thumbnail_html', 'disable_lightbox_amp' );
Below the html output in the non amp version
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Filter to change html output featured image’ is closed to new replies.