Home › Forums › General Issues › Displaying image in WooCommerce product category. › Reply To: Displaying image in WooCommerce product category.
Thanks for reply maira,
Yes the field name is $foto. but its not working.
Actually i want to add a label on the Product category images like this
http://prntscr.com/gefwfd
I have set the setting below way…
1. Set file name $foto
2. Return Value set to Image URL http://prntscr.com/geft8t
3. set rule, Taxonomy Term -> is equal to -> Product Categories
http://prntscr.com/gefrjw
4. The Image showing ok on the product category fields http://prntscr.com/geg1s2
5. added your code to functions.php
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 am a newbee, Sorry for bothering you. Would you like to suggest me what else need to do.
Thanks in advance
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.