Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Add classes to subcategory images.
*
* @param $category
*/
function kanuka_category_custom_thumbnail( $category ) {
$output = '';
ob_start();
woocommerce_subcategory_thumbnail( $category );
$output .= ob_get_clean();
$output = kanuka_add_class_to_tags( $output, array( 'img' ), 'object-contain max-height-100%' );
echo $output;
}
remove_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
add_action( 'woocommerce_before_subcategory_title', 'kanuka_category_custom_thumbnail', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment