From the course: WordPress: Advanced Custom Fields
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Displaying the repeater in your theme - WordPress Tutorial
From the course: WordPress: Advanced Custom Fields
Displaying the repeater in your theme
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Exploring advanced features of ACF2m 57s
-
(Locked)
What is repeatable data?2m 15s
-
(Locked)
Creating a repeater field3m 50s
-
(Locked)
Displaying the repeater in your theme5m 10s
-
(Locked)
Styling the repeater1m 29s
-
(Locked)
Coding a front-end submission form5m 37s
-
(Locked)
Creating the submission form page2m 8s
-
-
-
-