Skip to content

Instantly share code, notes, and snippets.

@goliver79
Last active September 7, 2015 18:10
Show Gist options
  • Save goliver79/8824355 to your computer and use it in GitHub Desktop.
Save goliver79/8824355 to your computer and use it in GitHub Desktop.
[WOOCOMMERCE] Get category thumbnail without resize
<?php
/*
* @goliver: overwrite function for get category thumbnail size without resize
* original in woocommerce-template.php
*/
function woocommerce_subcategory_thumbnail( $category ) {
global $woocommerce;
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' );
$dimensions = $woocommerce->get_image_size( $small_thumbnail_size );
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true );
if ( $thumbnail_id ) {
$image = wp_get_attachment_image_src( $thumbnail_id, 'post-thumbnail' );
$image = $image[0];
} else {
$image = woocommerce_placeholder_img_src();
}
if ( $image )
echo '<img src="' . $image . '" alt="' . $category->name . '" />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment