Home › Forums › ACF PRO › Can I have a repeater field with NO rows › Reply To: Can I have a repeater field with NO rows
Hi James,
I deeply appreciate your help!
Below is the JSON export, and here are three screenshots that I hope you’ll find helpful. Unfortunately I cannot change the Theme or plugins, it’s a live site and the current Theme and plugins provide a good deal of the site’s functionality – the whole thing would break if I switch.
That said, I really don’t think this is related to the Theme or other plugins, I believe that it’s simply my own inexperience with PHP (I’m a very novice coder) – I just don’t know how to structure my code so that it will show the header (“Additional Resources”) and then links IF there is data entered in at least 1 row, and not show either if there is not – I think looking at the screenshots will help the most, along with my code snippet above.
Here are the screenshots:
http://www.bestallinclusive.com/images/0_ScreenShot1.png
http://www.bestallinclusive.com/images/0_ScreenShot2.png
http://www.bestallinclusive.com/images/0_ScreenShot3.png
Here’s my JSON export:
[
{
"key": "group_55f2102aaf128",
"title": "Post: Additional External Resources",
"fields": [
{
"key": "field_55f21041f438e",
"label": "External Resources",
"name": "external_resources",
"type": "repeater",
"instructions": "<p>Use this field to add OFF-site links and the text anchor for the link. You may use the same for both fields. This will create a list of links below the post.<\/p>\r\n<p>Examples:<br>\r\nURL: http:\/\/urltomycoolsite.com\/ - Anchor Text: My Cool Site<br>\r\nOR<br>\r\nURL: http:\/\/urltomycoolsite.com\/ - Anchor Text: http:\/\/urltomycoolsite.com\/<\/p>",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "external-links",
"id": ""
},
"collapsed": "",
"min": "",
"max": 10,
"layout": "table",
"button_label": "Add More Rows",
"sub_fields": [
{
"key": "field_55f210bdf438f",
"label": "URL",
"name": "external_url",
"type": "url",
"instructions": "Enter the URL, including the http:\/\/",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "http:\/\/"
},
{
"key": "field_55f21102f4390",
"label": "Anchor Text",
"name": "external_anchor_text",
"type": "text",
"instructions": "Enter the Text that will be linked to the URL. May be the same as URL.",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
}
]
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.