Last active
February 12, 2019 15:12
-
-
Save NicBeltramelli/9500b6334e728af9740558ee2bd821fb to your computer and use it in GitHub Desktop.
Change number of thumbnails per row on WooCommerce product gallery.
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
<?php | |
// Do NOT include the opening php tag. | |
/** | |
* Change number of thumbnails per row on product gallery | |
* | |
* @author Nic Beltramelli | |
* | |
* @param array $wrapper_classes The number of thumbnails per row. | |
* @return array The modified wrapper class. | |
*/ | |
add_filter( | |
'woocommerce_single_product_image_gallery_classes', function ( $wrapper_classes ) { | |
$columns = 5; // Change this to n. Default is 4. | |
$wrapper_classes[2] = 'woocommerce-product-gallery--columns-' . absint( $columns ); | |
return $wrapper_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
.woocommerce { | |
div.product { | |
/* Product Gallery */ | |
div.images { | |
.woocommerce-product-gallery__image { | |
&:nth-child(n+2) { | |
width: 20%; | |
} | |
} | |
.flex-control-thumbs { | |
li { | |
width: 20%; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment