Last active
March 11, 2019 07:17
-
-
Save ibndawood/3301672b7a8c13ba7b47c1cf28316ca2 to your computer and use it in GitHub Desktop.
Electro - Product Image Flipper compatibility
This file contains hidden or 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
add_action( 'init', 'ec_child_remove_pif_actions', 20 ); | |
add_filter( 'electro_template_loop_product_thumbnail', 'ec_child_append_second_product_thumbnail', 20 ); | |
function ec_child_remove_pif_actions() { | |
global $WC_pif; | |
remove_action( 'woocommerce_before_shop_loop_item_title', array( $WC_pif, 'woocommerce_template_loop_second_product_thumbnail' ), 11 ); | |
} | |
function ec_child_append_second_product_thumbnail( $thumbnail ) { | |
if ( is_product() ) { | |
return $thumbnail; | |
} | |
$thumbnail = woocommerce_get_product_thumbnail(); | |
global $WC_pif; | |
ob_start(); | |
$WC_pif->woocommerce_template_loop_second_product_thumbnail(); | |
$second_thumbnail = ob_get_clean(); | |
$thumbnail = wp_kses_post( sprintf( '<div class="product-thumbnail">%s%s</div>', $thumbnail, $second_thumbnail ) ); | |
return $thumbnail; | |
} |
This file contains hidden or 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
body:not(.single-product) .products .pif-has-gallery a.woocommerce-LoopProduct-link [class*="wp-post-image"] { | |
-webkit-transition: opacity .5s ease; | |
-o-transition: opacity .5s ease; | |
transition: opacity .5s ease; | |
} | |
body:not(.single-product) .products .pif-has-gallery a.woocommerce-LoopProduct-link:hover .wp-post-image { | |
opacity: 0; | |
} | |
body:not(.single-product) .products .pif-has-gallery a.woocommerce-LoopProduct-link:hover .wp-post-image--secondary { | |
opacity: 1; | |
} | |
body:not(.single-product) .products .pif-has-gallery a.woocommerce-loop-product__link [class*="wp-post-image"] { | |
-webkit-transition: opacity .5s ease; | |
-o-transition: opacity .5s ease; | |
transition: opacity .5s ease; | |
} | |
body:not(.single-product) .products .pif-has-gallery a.woocommerce-loop-product__link:hover .wp-post-image { | |
opacity: 0; | |
} | |
body:not(.single-product) .products .pif-has-gallery a.woocommerce-loop-product__link:hover .wp-post-image--secondary { | |
opacity: 1; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment