Home › Forums › General Issues › How do you display Advanced Custom Fields in taxonomy-product_cat.php? › Reply To: How do you display Advanced Custom Fields in taxonomy-product_cat.php?
I’m not sure. Are you sure about the taxonomy name being “product_cat_” I’m assuming it is based on the name of the template file being used.
and you may need your action and function that you’d normally use for woocommerce. I don’t know a lot about how ACF plays with woocommerce.
What I do know is that your original code the_field('custom_category_content');
was not working because you were not supplying it with the needed id value to get the value of a custom field that is attached to a term according to the ACF doc (http://www.advancedcustomfields.com/resources/functions/the_field/)
You can make sure that $term_id = get_queried_object()->term_id;
is returning a valid term ID.
$object = get_queried_object();
echo $object->term_id;
you can even check the entire queried object to see what’s in there
object = get_queried_object();
print_r($object);
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.