Last active
December 19, 2020 01:24
-
-
Save Bradley-D/9479200 to your computer and use it in GitHub Desktop.
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 the div to wrap the image on the archive pages | |
add_action( 'woocommerce_before_shop_loop_item_title', create_function('', 'echo "<div class=\"archive-img-wrap\">";'), 5, 2); | |
add_action( 'woocommerce_before_shop_loop_item_title',create_function('', 'echo "</div>";'), 12, 2); | |
// If there is sub categories on the archive page add a wrap around their images as well | |
add_action( 'woocommerce_before_subcategory_title', create_function( '', 'echo "<div class=\"sub-archive-img-wrapper\">";'), 5, 2 ); | |
add_action( 'woocommerce_before_subcategory_title', create_function( '', 'echo "</div>";' ), 12, 2 ); |
function addWrapper() {
echo "<div class=\"imagewrapper\">";
}
add_action( 'woocommerce_before_shop_loop_item_title', 'addWrapper', 5, 2 );
// Add the div to wrap the image on the archive pages
function closeWrapper(){
echo "</div>";
}
add_action( 'woocommerce_before_shop_loop_item_title', 'closeWrapper', 12, 2 );
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately, create_function is deprecated in php 7.2, any idea how to replace this part? Thanks a lot :)