Support

Account

Home Forums General Issues Foreach Tab

Helping

Foreach Tab

  • I have a page with 4 ACF tabs. is there a way in my template to include a foreach tab function?

    Thanks

  • Tabs are not actually fields and are not stored. The fields in each tab are not associated with the tab in any way. Tabs are just an admin layout feature of ACF. So really, there is nothing in ACF itself that will allow you to do this.

    If I found myself needing to do this I would probably create a nested array that defined the fields I wanted to show for each tab and then loop through that array to create the foreach tab effect, something like:

    
    $array = (
      array(
        // these are the field names for tab 1
        'name_1',
        'name_2',
        'name_3',
        'name_4'
      ),
      array(
        // these are the field names for tab 2
        'name_5',
        'name_6',
        'name_7',
        'name_8'
      )
    )
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Foreach Tab’ is closed to new replies.