-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: compatibility with Woocommerce, solving issue with zoom image on…
… single product pages
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* Class Optml_woocommerce. | ||
* | ||
* @reason Zoom image on product pages uses a the lqip placeholder instead of the full size image. | ||
*/ | ||
class Optml_woocommerce 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( 'woocommerce/woocommerce.php' ); | ||
} | ||
|
||
/** | ||
* Register integration details. | ||
*/ | ||
public function register() { | ||
add_filter( 'optml_watcher_lz_classes', [ $this, 'add_watcher_class' ], 10, 1 ); | ||
} | ||
|
||
/** | ||
* Add classes for watching for late lazyload. | ||
* | ||
* @param string $classes Old classes. | ||
* | ||
* @return array New classes. | ||
*/ | ||
public function add_watcher_class( $classes = array() ) { | ||
$classes[] = 'zoomImg'; | ||
|
||
return $classes; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters