Skip to content

Commit

Permalink
fix: adds compatibility with background images lazyload on Essential …
Browse files Browse the repository at this point in the history
…Grid plugin
  • Loading branch information
selul committed Mar 28, 2019
1 parent 60169b2 commit a73d1cd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions inc/compatibilities/essential_grid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Class Optml_metaslider.
*
* @reason Metaslider behaves strange when the noscript tag is present near the image tag.
*/
class Optml_essential_grid extends Optml_compatibility {


/**
* Should we load the integration logic.
*
* @return bool Should we load.
*/
function should_load() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

return is_plugin_active( 'essential-grid/essential-grid.php' );
}

/**
* Register integration details.
*/
public function register() {
add_filter( 'optml_lazyload_bg_classes', [ $this, 'add_bg_class' ], PHP_INT_MAX, 1 );
}

public function add_bg_class( $classes ) {
$classes[] = 'esg-media-poster';

return $classes;
}


}
1 change: 1 addition & 0 deletions inc/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ final class Optml_Manager {
'revslider',
'metaslider',
'woocommerce',
'essential_grid',
'yith_quick_view',
);

Expand Down

0 comments on commit a73d1cd

Please sign in to comment.