Home › Forums › Add-ons › Repeater Field › Issue with repeater rows and conditional statement › Reply To: Issue with repeater rows and conditional statement
The problem is that the repeater on the category still has rows. Deleting a post, category, or whatever might be in a repeater row will not remove that row from the repeater.
Sorry, because of the way you are doing this I cannot give you code. I can only give you an idea.
You need to loop over the first repeater and detect if any output is created, if not then do the second repeater.
Basic example
$output_created = false;
if (have_rows('repeater')) {
while (have_rows('repeater')) {
the_row();
// if you generate any content here
$output_created = true;
}
}
if (!$output_created) {
// noting created in the first loop
// do the other repeater
}
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.