Skip to content

Instantly share code, notes, and snippets.

@mergeweb
Last active August 29, 2015 14:21
Show Gist options
  • Save mergeweb/903412b6dedbf6354890 to your computer and use it in GitHub Desktop.
Save mergeweb/903412b6dedbf6354890 to your computer and use it in GitHub Desktop.
ACF Fields Repeatable
{
"id":"whitepaper_acf",
"title":"Whitepaper ACF",
"location":[
[
{
"param":"post_type",
"operator":"==",
"value":"upnup-whitepapers",
"order_no":0,
"group_no":0
}
]
],
"options":{
"position":"normal",
"layout":"no_box",
"hide_on_screen":[
"permalink",
"the_content",
"custom_fields",
"discussion",
"comments",
"revisions",
"author",
"format",
"categories",
"tags",
"send-trackbacks"
]
},
"menu_order":0,
"fields":[
{
"label":"Whitepaper Download",
"name":"whitepaper_download",
"type":"file",
"save_format":"url",
"library":"all",
"instructions":"Please be sure to check the size of the file before uploading.",
"key":4271621926
},
{
"label":"Featured Image",
"name":"featured_image",
"type":"image",
"save_format":"id",
"preview_size":"whitepaper-feature",
"library":"all",
"key":1789204237
},
{
"label":"Copy",
"name":"copy",
"type":"textarea",
"default_value":"",
"placeholder":"",
"maxlength":"",
"rows":"",
"formatting":"br",
"key":3985118396
},
{
"label":"Features",
"name":"features",
"type":"repeater",
"row_min":"",
"row_limit":"",
"layout":"row",
"button_label":"Add Item",
"sub_fields":[
{
"label":"Inside Item",
"name":"inside_item",
"type":"text",
"default_value":"",
"placeholder":"",
"prepend":"",
"append":"",
"formatting":"html",
"maxlength":"",
"key":2001365730
}
],
"instruction":"What is inside this whitepaper",
"key":1186381381
}
]
}
<?php get_header(); ?>
<?php
// This works
$copy = get_field('copy');
echo $copy;
// This returns the # of items in the array
$items = get_field('features');
// I expect an array, instead I get the number of items in the array
print_r($items);
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment