MODULE 03 · FUNCTIONALITY & CUSTOMIZATION

Custom Fields & ACF

Your Testimonial post type from Day 19 has a title and body — but what about a name, a rating, or a company logo? Custom fields let you attach structured data to any post, and Advanced Custom Fields (ACF) makes building them painless.

Day 20 of 30 Intermediate ~20 min

Extra Data Beyond the Editor

Every post and page has a title and a content area — but plenty of real content doesn't fit neatly into a paragraph. A star rating, a price, a due date, an author's job title. Custom fields (also called "meta") let you attach extra, structured pieces of data to any post, independent of the main content.

WordPress has supported basic custom fields since its earliest versions, but the default interface is a plain key-value box that's easy to mistype. Advanced Custom Fields (ACF) replaces that with a proper form builder.

What ACF Can Store

ACF ships with dozens of field types, but a handful cover most real-world needs.

FIELD TYPE USE CASE
Text / Textarea

Short labels or longer plain text — a job title, a short bio.

Image

A dedicated image separate from the featured image — a logo, a headshot.

Number / Range

A rating, a price, or any value that should stay numeric.

Select / Radio

A fixed list of choices — department, category, or status.

Repeater

A repeatable group of fields — multiple team skills, multiple gallery items.

THINK OF IT AS

The default editor handles "what the page says." Custom fields handle "the structured facts about the page."

From Blank Group to Live Fields

  • Install and activate the free Advanced Custom Fields plugin.
  • Go to Custom Fields → Add New to create a field group.
  • Add fields one at a time, choosing a type and a field name for each.
  • Set the location rule — for example, "Post Type is equal to Testimonial."
  • Publish the field group and open a Testimonial to see the new fields appear.
  • Fill in the fields on an entry and publish it to save the data.
  • Reading a Custom Field in a Template

    template-snippet.php
    // Inside a template file, inside the loop
    <?php
    $rating = get_field('star_rating');
    ?>
    
    <p>Rating: <?php echo $rating; ?> / 5</p>

    ACF's get_field() function pulls a saved value by its field name, ready to print anywhere in a template.

    Do You Need the Paid Version?

    FREE VERSION LIMITS The free tier doesn't include Repeater, Flexible Content, or Gallery fields — the ones needed for repeatable groups of data.
    WHEN FREE IS ENOUGH For single values like a rating, a price, or a subtitle, the free version covers everything — save Pro for repeatable or flexible layouts.

    Common Custom Field Mistakes

    WATCH FOR THESE
    RENAMING A FIELD Changing a field's name after content has been entered breaks the connection to already-saved data.
    NO EMPTY CHECK Printing a field without checking it has a value can leave visible gaps on posts where it was left blank.
    WRONG LOCATION RULE A field group scoped too broadly shows irrelevant fields on post types that don't need them.

    Breaking Down What You Just Learned

    1

    Custom fields store structured dataExtra facts about a post, separate from the main content area.

    2

    ACF replaces raw meta boxesA visual field builder instead of manually typed key-value pairs.

    3

    Location rules control where fields appearA field group can target a specific post type, page, or template.

    4

    get_field() displays valuesTemplates pull saved data by field name to print it anywhere on the page.

    5

    Free vs ProRepeater and Flexible Content fields require the paid version; single-value fields don't.

    Try It Yourself

    EXERCISE

    Create a field group with a Number field called "star_rating" and a Text field called "client_name," scoped to your Testimonial post type. Fill both in on an existing entry.

    Add Structured Data to Your Capstone Site

    HANDS-ON EXERCISE

    Giving your custom post type real, structured fields

    By the end of today, the custom post type from Day 19 should display at least one custom field value on the front end.

    1. Install Advanced Custom Fields.
    2. Create a field group with at least two fields relevant to your post type.
    3. Scope the field group's location rule to that post type only.
    4. Fill in the fields on your existing entries.
    5. If comfortable with template code, print one field value using get_field().

    Recap

    CUSTOM FIELD

    A piece of structured data attached to a post, separate from the main content.

    FIELD GROUP

    A set of related fields, scoped to specific post types or templates.

    LOCATION RULE

    The condition that decides where a field group appears in the admin.

    get_field()

    The function templates use to read and display a saved field value.

    Key Takeaways

    • Custom fields attach structured data to a post beyond its title and main content.
    • ACF replaces WordPress's raw meta box with a visual field builder.
    • Location rules keep field groups scoped to the post types or templates that actually need them.
    • Templates read saved values with get_field() to display them anywhere on the page.
    • Repeater and Flexible Content fields require ACF Pro; single-value fields work in the free version.
    Course Overview