Home › Forums › General Issues › my custom field does not appear ?
Hi,
my custom field is not loading ?
I try to tell with screenshots step by step. can you help me pls?
Thank you.
Hi @korkor
Are you sure you’re looking in the right place?
In the sourcecode there is a <div class="kwayy-team-group-desc">
but looking at your code template where you post the code there is not.
That aside. When you work with something other than a post type you need to specify the second parameter as taxonomy_termid
.
So a call to the_field()
where you want to fetch info from a term should look like:
the_field('field_name', 'taxonomy_termid')
where taxonomy is your tax slug and termid is the terms id.
Check this documentation out: https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/
Hello,
The problem you have here is that get_field needs to have an additional parameter in it to specifically say which taxonomy term it is supposed to look at for the content.
https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/
In this instance, you’ll be looking to output the field on the taxonomy page, which would be the following code:
// vars
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
// load thumbnail for this taxonomy term (term string)
$service_editor = get_field('service_editor', $taxonomy . '_' . $term_id);
echo $service_editor;
Edit: Sorry Jonathan, I didn’t refresh the page before I posted and didn’t see your reply. Hope either of our responses help.
Haha no worries @imaginedd
You’ve provided a code snippet which I was too lazy to do 😉
It’s interesting to know that in later versions of ACF you can also provide the term object as a second parameter. I wouldn’t recommend it in this case since it’d just require an additional function call but it’s good to know when you’re doing a custom loop of get_terms()
for example.
The topic ‘my custom field does not appear ?’ is closed to new replies.
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.