Home › Forums › Front-end Issues › Custom Field Not Displaying in Front End › Reply To: Custom Field Not Displaying in Front End
You need to specify the “$post_id” value when getting fields from a term.
The post ID to use is "$taxonomy_$term_id"
The taxonomy name I know, it is “product_cat” but you need to get the term id for the currently displayed category and them put them together.
Something like this might work, but you may need to work on it
$queried_object = get_queried_object();
$post_id = $queried_object->taxonomy.'_'.$queried_object->term_id;
the you can supply the correct post id when getting the acf field
<div style="background-image: url('<?php
the_field(‘category_background_image', $post_id); ?>');">
this is all covered under getting values from other places here http://www.advancedcustomfields.com/resources/get_field/
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.