While you looked at how to add your basic fields in an earlier chapter, repeater fields can be a little more complicated, so it's important to see an example of how this works. In this video, add your new repeater data to the child theme and display it by checking to see if there‘s data using have_rows, and introducing a new function called get_sub_field.
- [Instructor] With our repeater field created, … it's time to add it to our theme. … This is going to be slightly different … than how we added the previous fields … because in essence a repeater field is an array of fields. … Luckily, if you're familiar with the WordPress loop, … the syntax will look very familiar. … Open up your code editor to our child theme … and then open content dash single dot PHP. … We're going to add this code right … after the profile description and before the friends field … around line 30. … First we'll call a function called have_rows. … This is a function provided by advanced custom fields … to check to see if our repeaters field has any data in it. … Our repeated field is named resume, all lower case. … That's the field name that will provide. … If our repeater field does have rows, … we're going to open up a new div with the class resume. … Then much like our friends field, … we're going to set up a format and use printf … to print out each field. … So we'll create a new variable called resume_format …
- What are custom fields?
- Creating field groups
- Adding content to fields
- Displaying fields on a child theme
- Creating and displaying repeater fields
- Creating a submission form
- Creating a Gutenberg block with PHP only
- Writing rules for field display
- Organizing fields
- Exporting field groups
Skill Level Advanced
1. Getting Started with ACF
2. Creating Field Groups with ACF
Field types overview3m 48s
3. Displaying Your Fields
4. Working with Data in ACF
5. Creating a Gutenberg Block
6. Cleaning Up the Admin
Next steps1m 13s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.