• 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 4 years, 1 month ago by Ommy.
    • This topic was modified 4 years, 1 month ago by Ommy.
    • This topic was modified 4 years, 1 month ago by Ommy.
    • This topic was modified 4 years, 1 month ago by Ommy.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Luminus Alabi

    (@luminus)

    Automattic Happiness Engineer

    @bounomid,

    You’ll need to modify that code snippet to wrap the image in an anchor tag that links to the correct page.

    Thread Starter Ommy

    (@bounomid)

    Unfortunately I don’t have enough knowledge of coding, can you please help me ?

    Thread Starter Ommy

    (@bounomid)

    No one for help? I have more than 1000 products, It will really help to solve this problem

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘show clickable parent category img’ is closed to new replies.