I’m having some issues displaying data and as I’m not a developer, I’d appreciate your help.
I have a repeater named “awards” with 3 relationship fields inside: “award_name”, “award_category” and “award_level”. They are related to custom post types and work fine on the admin UI.
But when I try to get the data at the single.php I fail miserably.
I’ve tried a lot and that’s my code right now:
while( have_rows('awards') ) : the_row();
// create variables for sub field values
$sub_field = get_sub_field('award_name');
<li><?php echo $sub_field; ?></li>
<?php endwhile; ?>
It is not returning anything.
When I var_dump, I get this: string(0) “”
There isn’t enough information here because you say that if you use var_dump() that you get not value. That tells me that there is no value in the relationship field. So either there is no value or there is more information that I would need to have.
Is the awards field a sub field of some other field? (group, repeater, flex)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users