Skip to content

Instantly share code, notes, and snippets.

@raphaelchaib
Forked from jameskoster/functions.php
Last active August 29, 2015 14:17
Show Gist options
  • Save raphaelchaib/8d9cee79b8737ac0212f to your computer and use it in GitHub Desktop.
Save raphaelchaib/8d9cee79b8737ac0212f to your computer and use it in GitHub Desktop.
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '<img src="' . $image . '" alt="" />';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment