Support

Account

Home Forums General Issues Displaying image in WooCommerce product category. Reply To: Displaying image in WooCommerce product category.

  • Hi Maira,

    I want to add different feature image for different product category. I am using Maisha theme.

    I used your code but it is not working. I am very new to PHP. And i just used your code as it is. Can you please help me figure out what I am doing wrong.

    if ( is_product_category() ) {
    // vars
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    $foto = get_field( ‘foto’, $queried_object );
    $foto = get_field( ‘foto’, $taxonomy . ‘_’ . $term_id );
    if( get_field(‘foto’, $taxonomy . ‘_’ . $term_id) ) {
    echo ‘<div class=”cat-banner”></div>’;
    }
    }

    I did not get field foto. Could you please explain it more. In previous post you said change it or make sure field name is same . What field name are we talking about here.