Created
September 16, 2021 11:28
-
-
Save mustardBees/2288e85d5d6a94341524da7ad2787306 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
| <?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