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 relational fields

Displaying relational fields - WordPress Tutorial

From the course: WordPress: Advanced Custom Fields

Start my 1-month free trial

Displaying relational fields

- [Instructor] With HL being properly defined, it's time to add the fields to our post-template. To do that, we'll need to modify the template that controls our single post output. In the astra theme, that is a file called content-single in the template parts folder. We're going to need to recreate that file structure exactly in our child theme. We'll do that by copying the content-single.php template and then going into our astra child theme, adding a new folder called template-parts and then pasting the file we just copied. We'll close the astra template so we don't confuse things and then we'll scroll to around line 19, which is astra_entry_content_single. Here is where we'll add our custom code. Just as a refresher, we have three custom fields that we want to add to our template. If we look in the name column of our field group, we'll see the names that we need to grab: profile_description, location, and friends. First, let's add our location and profile description. We'll open up…

Contents