Created
December 2, 2012 09:10
-
-
Save aprakasa/4187867 to your computer and use it in GitHub Desktop.
WooCommerce - Display Category Image
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
// verify that this is a product category page | |
if (is_product_category()){ | |
global $wp_query; | |
// get the query object | |
$cat = $wp_query->get_queried_object(); | |
// get the thumbnail id user the term_id | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
// get the image URL | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
// print the IMG HTML | |
echo '<img src="'.$image.'" alt="" width="762" height="365" />'; | |
} |
Thanks so much, this code help me,
how can i put this on single-product.php?
this code isnt work in single product....
Thanks
Very cool, thank you
Display category image on single product page: https://wordpress.org/support/topic/display-category-image-on-single-product-page?replies=5
Perfect!
Work Perfect. Thank You....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works nicely.