Home › Forums › General Issues › Display custom field from category on child single page › Reply To: Display custom field from category on child single page
Hello John,
Thank you for your help.
Indeed, I’m talking about a single post page.
Do I need to specify that it’s a category from a custom post type ?
So it’s a taxonomy called “destinations”.
So I adapt your code like this in my template single-destinations.php, no ? :
<?php $top_term = $term;
if ($term->parent) {
// term has a parent
$ancestors = get_ancestors($term_id, 'destinations', 'taxonomy');
$top_term_id = array_pop($ancestors);
$top_term = get_term($top_term_id, 'destinations');
}
if(get_field('big_image', $top_term)) { ?>
<p>Hello !</p>
<?php } ?>
Nothing happens… 🙁 Is there something wrong ?
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.