Adding Caption to Product Category Thumb
-
Hello everyone,
Can someone make a suggestion on how to simply add the image caption to the product category image. I’m using this code from :
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="" />'; } } }This would display it inside the post loop:
<?php the_post_thumbnail(); echo get_post(get_post_thumbnail_id())->post_excerpt; ?>Unfortunately I do not know how to add that to the function. Would it be better to modify the page that is outputting the product category information?
Thanks whoever may take an interest 🙂
Chris
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Adding Caption to Product Category Thumb’ is closed to new replies.