Support

Account

Forum Replies Created

  • Good question. No custom query happening. I even tried doing a wp_reset_postdata() at the top of the template part before the ACF loop to see if that would help, but no luck.

  • I should also note that I am using get_template_part if get_row_layout matches a string. And I just tried moving this echo count( get_sub_field('testimonials_module' ) ); outside of the get_template_part and it works!

    I think I just found the issue but it is still super confusing. At the top of my template part I have this:

    if ( ! have_rows( 'testimonials_module' ) ) {
    	return;
    }

    If I call echo count( get_sub_field('testimonials_module' ) ); before this conditional it works fine but after it, it returns false. How would this effect the return of get_sub_field when that conditional is returning false?

    PHP version is 7.0.7. Valid question, but yet I am sure it is a repeater since the while( have_rows() ) loop is working and actually returning my data.

    Weird, right?! Thanks for responding.

  • PHP7 is running on the server and the field is a repeater. I’m trying to get a count of the repeater items with $count = count( get_sub_field( 'testimonials_module' ) );. I’ve even tried this with get_the_ID() as the second param to force this but that did not work either. A dump of get_the_ID() is pulling the correct ID by the way.

  • I just ran into this same issue with the Flexible Content layouts and I am still getting an error on get_sub_field.

    The only difference is get_field() returns NULL and get_sub_field() returns bool(false)

    The odd thing is that the rest of the loop works just fine with while( have_rows() ) and I can loop through this and retrieve my data.

    My layout is called Testimonials and the name is the same. My repeater in this layout is called has a field name of testimonials_module.

    Any Ideas?

Viewing 4 posts - 1 through 4 (of 4 total)