Hello!
The code we’ve generated will work if you want to display the values on a taxonomy template.
It sounds like you’ve assigned your field to a custom taxonomy and you want to display the values on a single.php type template.
To to this you’ll need to get the ID of the custom ‘term’ and pass that along with your field name.
So your code might look something like this
$term_id = 1; // eg 1 is the ID of the custom term
the_field('store_description', 'term_'.$term_id);
Also, here are some docs on the ACF site that might help:
https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
-
This reply was modified 6 years, 5 months ago by
Aaron Rutley. Reason: code formatting
-
This reply was modified 6 years, 5 months ago by
Aaron Rutley.
Thanks for the reply. You are right. I have assigned my field to a custom taxonomy and I do want to display the values on a single.php type template.
Using your code I was able to get the custom field to display but it’s not really the solution I was looking for.
I actually have 58 terms in this custom taxonomy and I was hoping to have the descriptions for each of them display in the correct posts. Using the code you provided I can display the description from one particular term on every page.
I’ll try to clarify here. In this case, the custom taxonomy is “store” and the terms are store names. I want to add the store description in the field and have it display on the correct posts.
My guess is that instead of
$term_id = 1;
I need something that will fetch the term_id for that page.
Would you know how to do that?
I couldn’t figure it out.
Unfortunately, this is outside the scope of our free support
If I pay for the support will I get a solution?
Yes, if you purchase the Pro version it includes support and I can help you solve this! https://hookturn.io/downloads/acf-theme-code-pro/
Sounds good. One more pre-sale Q.
In this case, there should only be one custom taxonomy term (one store) per post.
But in another case, there are possibly multiple custom taxonomy terms (artist collaborations).
Will you be able to show me how to output multiple descriptions?
OK, I purchased. What do I need to do?
Ok great! Please contact us via our contact page: https://hookturn.io/contact/