Support » Plugin: WooCommerce » show clickable parent category img

  • Hello There
    I have already this code to show category Img in product page. It works well but its not clickable.
    I want it to act as a thumbnail and go to parrent category after click.
    Thanks for help

    <?php
        $terms = get_the_terms( $post->ID, 'product_cat' );
        foreach ( $terms as $term ){
            $category_name = $term->name;
            $category_thumbnail = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
            $image = wp_get_attachment_url($category_thumbnail);
            echo '<img src="'.$image.'">';
        }
    ?>
    • This topic was modified 1 year, 3 months ago by Ommy.
    • This topic was modified 1 year, 3 months ago by Ommy.
    • This topic was modified 1 year, 3 months ago by Ommy.
    • This topic was modified 1 year, 3 months ago by Ommy.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘show clickable parent category img’ is closed to new replies.