I am using ACF to allow the user to choose a blog to display on their homepage. I’ve managed to get that to work using a Post Object field, and then calling the title, link, and content using WP hooks. However, the blog also has a repeater field associated with it for “authors” as they want to be bale to specify a different author for their posts than the person who published them. My problem is, I can’t for the life of me figure out how to get this repeater field to display for the blog post. Here’s the code I am using.
// check if the repeater field has rows of data
if( have_rows(‘authors’) ):
// loop through the rows of data
while ( have_rows(‘authors’) ) : the_row();
// display a sub field value
// no rows found
<?php wp_reset_postdata(); // IMPORTANT – reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
The repeater field “author” doesn’t show up no matter what I do. I can call the publisher of the post using WP Functions but that isn’t what I need. Thank you in advance for any help any of you can provide.
Viewing 1 post (of 1 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
Making gutenprogress with my new site. All done with the block editor. I don't like it, but I can make it work. (There's a lot in life like that.) HOWEVER, @wp_acf is letting me create custom blocks that do exactly what I need. That's a good thing.