Skip to content

Instantly share code, notes, and snippets.

@wurwal
Last active August 9, 2019 09:47
Show Gist options
  • Save wurwal/4fcf02567fc2d99b70c41eac41c0f8da to your computer and use it in GitHub Desktop.
Save wurwal/4fcf02567fc2d99b70c41eac41c0f8da to your computer and use it in GitHub Desktop.
ACF Repeater and sub repeater integrated into Foundations Horizontal Tabs
[
{
"key": "group_5d499dde6bd04",
"title": "Repeating_Tabs",
"fields": [
{
"key": "field_5d49a08552d96",
"label": "Repeating Tabs",
"name": "download_tabs",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": 0,
"max": 0,
"layout": "table",
"button_label": "",
"sub_fields": [
{
"key": "field_5d49a0a852d97",
"label": "Tab Title",
"name": "tab_title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5d49a2eac46de",
"label": "Tab Content",
"name": "tab_downloads",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": 0,
"max": 0,
"layout": "block",
"button_label": "",
"sub_fields": [
{
"key": "field_5d4abac91ff01",
"label": "Download Image",
"name": "download_image",
"type": "image",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "id",
"preview_size": "medium",
"library": "all",
"min_width": "",
"min_height": "",
"min_size": "",
"max_width": "",
"max_height": "",
"max_size": "",
"mime_types": ""
},
{
"key": "field_5d4abb041ff02",
"label": "Date",
"name": "date",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "DD.MM.YY",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5d49a309c46df",
"label": "Download Title",
"name": "download_title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5d4abb231ff03",
"label": "Download File",
"name": "download_file",
"type": "file",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "url",
"library": "all",
"min_size": "",
"max_size": "",
"mime_types": ""
}
]
}
]
}
],
"location": [
[
{
"param": "post_template",
"operator": "==",
"value": "page-templates\/template-downloads.php"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"permalink",
"the_content",
"excerpt",
"discussion",
"comments",
"revisions",
"slug",
"author",
"format",
"page_attributes",
"featured_image",
"categories",
"tags",
"send-trackbacks"
],
"active": true,
"description": ""
}
]
<div class="grid-container">
<div class="grid-x grid-margin-x align-center downloads">
<div class="small-12 medium-11 large-11 cell">
<ul class="tabs tabs-downloads grid-x" data-tabs id="download-tabs">
<?php $count = 0; ?>
<?php if ( have_rows( 'download_tabs' ) ) : ?>
<?php while ( have_rows( 'download_tabs' ) ) : the_row(); ?>
<?php $count++; ?>
<li class="tabs-title cell large-auto <?php if ($count == 1) { ?> is-active <?php } ?>"><a data-tabs-target="panel<?php echo $count;?>" href="#panel<?php echo $count;?>"><?php the_sub_field( 'tab_title' ); ?></a></li>
<?php endwhile; ?>
<?php else : ?>
<?php echo "no tabs defined" ?>
<?php endif; ?>
</ul>
<div class="tabs-content" data-tabs-content="download-tabs">
<?php $count2 = 0; ?>
<?php if ( have_rows( 'download_tabs' ) ) : ?>
<?php while ( have_rows( 'download_tabs' ) ) : the_row(); ?>
<?php $count2++; ?>
<div class="tabs-panel <?php if ($count2 == 1) { ?> is-active <?php } ?>" id="panel<?php echo $count2;?>">
<div class="grid-x grid-margin-x">
<?php if ( have_rows( 'tab_downloads' ) ) : ?>
<?php while ( have_rows( 'tab_downloads' ) ) : the_row(); ?>
<div class="small-12 medium-4 cell text-center content-card content-card--scale content-card--download">
<?php the_sub_field( 'your_tab_content_fields_here' ); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment