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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.