| @@ -11,11 +11,12 @@ | ||
| 11 | 11 | * Should we load the integration logic. |
| 12 | 12 | * |
| 13 | 13 | * @return bool Should we load. |
| 14 | 14 | */ |
| 15 | - function should_load() { | |
| 16 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
| 17 | - return is_plugin_active( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ) && 'enabled' === get_option( '_uagb_allow_file_generation', 'enabled' ); | |
| 15 | + public function should_load() { | |
| 16 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 17 | + | |
| 18 | + return is_plugin_active( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ); | |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Register integration details. |
| @@ -21,8 +22,17 @@ | ||
| 21 | 22 | * Register integration details. |
| 22 | 23 | */ |
| 23 | 24 | public function register() { |
| 24 | 25 | add_filter( 'uagb_block_attributes_for_css_and_js', [ $this, 'optimize_src' ], PHP_INT_MAX, 2 ); |
| 26 | + | |
| 27 | + add_filter( | |
| 28 | + 'optml_lazyload_bg_selectors', | |
| 29 | + function ( $all_watchers ) { | |
| 30 | + $all_watchers[] = '.wp-block-uagb-container'; | |
| 31 | + | |
| 32 | + return $all_watchers; | |
| 33 | + } | |
| 34 | + ); | |
| 25 | 35 | } |
| 26 | 36 | |
| 27 | 37 | /** |
| 28 | 38 | * Optimize the src attribute. |