Last active
June 23, 2017 22:36
-
-
Save WPprodigy/937774ee0505cd22bbc07079fb741516 to your computer and use it in GitHub Desktop.
Add Brands image to archives.
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
add_action( 'woocommerce_archive_description', 'woocommerce_brand_image_custom', 18 ); | |
function woocommerce_brand_image_custom() { | |
if ( is_tax( 'product_brand' ) ){ | |
global $wp_query; | |
$category = $wp_query->get_queried_object(); | |
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true ); | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
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