Support

Account

Home Forums Front-end Issues Using have_rows() in different template not working

Solved

Using have_rows() in different template not working

  • Hi,

    I don’t know if someone encountered this or solved this one or if this is an easy fix.

    I have a 2 repeaters(featured_designers & our_designers) inside a field group(Designers). I was able to display the featured_designers using have_rows() functionality on my homepage, however, when I tried adding our_designers to a different custom template(About Template), the value is empty? I used the same code from my homepage and just changed the field name in have_rows(). Can someone help me on this one? I attached the comparison between the two codes.

  • Hello… when referencing an ACF field, sometime you need to pass in the “post/page/CPT ID”… other times it assumes *current* post/page.

    It depends where you are creating the data… if it’s an Options Page, pass in “option” as the second parameter, like:

    <p><?php the_field('field_name', 'option'); ?></p>

    Hope that helps!

  • @keithlock Thanks man! You’re correct, I need to pass in the current post to make it work. In my case, I added the ID to get the field value. Thanks again for your help.

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

The topic ‘Using have_rows() in different template not working’ is closed to new replies.