Skip to content

Instantly share code, notes, and snippets.

@anastransvelo
Forked from ibndawood/functions.php
Last active March 20, 2019 19:26
Show Gist options
  • Save anastransvelo/9e1dbe184bc53298e165ef77552963cb to your computer and use it in GitHub Desktop.
Save anastransvelo/9e1dbe184bc53298e165ef77552963cb to your computer and use it in GitHub Desktop.
Electro - Product Image Flipper compatibility
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;
}
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;
}
body:not(.single-product) .products .pif-has-gallery .product-thumbnail {
position: relative;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment