This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

ACF Theme Code for Advanced Custom Fields

Description

The ACF Theme Code plugin automatically generates the code needed to implement Advanced Custom Fields in your themes.

Video note: This free version of ACF Theme Code now supports ACF 5.

Features

Reduce your development time.

  • When you publish, edit or update an ACF Field Group, the code required to implement your fields is displayed in the Theme Code section at the bottom of your Edit Field Group page.
  • Use the clipboard icons in this section quickly copy and paste the code blocks into your theme templates.

Quality, flexible, custom code.

Comprehensive field support

  • This version of ACF Theme Code generates code for all the field types included in the free version of Advanced Custom Fields (see the full list of field types and settings below).
  • The code generated is specific to the field names and field settings you use for each of your fields.

ACF Theme Code PRO

ACF Theme Code PRO is the premium version of this plugin. It has the following additional features.

  • Support for all the complex field types that are included in Advanced Custom Fields PRO.
    • Repeater
    • Flexible Content
    • Gallery
    • Clone
  • The addition of a Theme Code Location Registration Tool to the ACF Tools page that generates code for registering locations.
    • Blocks
    • Options Pages
  • Support for more complex ACF Field Group Locations.
    • Block
    • Options Page
    • Widget
    • Taxonomy
    • Comment
    • Attachment
    • Current User
    • User Form
  • Support for a range of third party fields.

Upgrade or learn more about ACF Theme Code PRO.

ACF fields supported

This free version of ACF Theme Code generates code for the following ACF field types and settings:

  • Text
  • Text Area
  • Number
  • Range
  • Email
  • URL
  • Password
  • Image (return types Array, URL and ID)
  • File (return types Array, URL and ID)
  • WYSIWYG Editor
  • oEmbed
  • Select (values Single and Multiple, return types Value, Label and Array)
  • Checkbox (return types Value, Label and Array)
  • Radio Button (return types Value, Label and Array)
  • Button Group (return types Value, Label and Array)
  • True / False
  • Link (return types Array and URL)
  • Post Object (values Single and Multiple, return types Post Object and Post ID)
  • Page Link (values Single and Multiple)
  • Relationship (return types Post Object and Post ID)
  • Taxonomy (appearances Checkbox, Multi Select, Radio Buttons and Select, return types Term Object and Term ID)
  • User (values Single and Multiple, return types User Array, User Object and User ID)
  • Google Map
  • Date Picker
  • Date Time Picker
  • Colour Picker
  • Group

Requirements

  • Advanced Custom Fields or ACF PRO (version 5.8.9 or higher)

Thank you

Thanks to all of our beta testers. Including Elliot Condon, Phil Smart, Richard Johnston and James Bundey.

Screenshots

  • The code required to implement each field is displayed for you in the Theme Code section.

Installation

From your WordPress dashboard

  1. Visit Plugins > Add New.
  2. Search for “ACF Theme Code”.
  3. Activate ACF Theme Code for Advanced Custom Fields from your Plugins page.
  4. Publish, Edit or Update an ACF Field Group.
  5. Scroll down the Edit Field Group page to the Theme Code section to see the code generated.

FAQ

Does this plugin support ACF PRO?

This free version of ACF Theme Code supports all the field types from ACF PRO that are also found in the free version of Advanced Custom Fields.

The ACF Theme Code PRO plugin also supports extra fields found only in ACF PRO. These include the Repeater, Flexible Content, Gallery and Clone fields. It also supports ACF PRO features ACF Blocks and Options Pages.

Does this plugin generate the code needed for different field group Locations?

This free version of ACF Theme Code supports all the Post and Page field group Locations.

The ACF Theme Code PRO plugin also supports a bunch of other field group Locations. These include Block, Options Page, Widget, Taxonomy, Comment, Attachment, Current User and User Form.

Reviews

May 24, 2020
You will love this plugin if you work with ACF is a must to have ! i like the development behind this plugin!
April 7, 2020
This plugin is now one of the first to be installed on any new project I create. From copying simple single lines to blocks of code (esp when using repeater fields) it's an absolute gem and huge time saver. Cannot recommend it enough, 5+ stars!
February 25, 2020
I've recommended this plugin to various customers and they love it. It's very helpful to them.
January 14, 2020
Bought the pro version and it is a huge help, even if you know how to code - copy + paste is just faster 😉 especially when you have nested a lot of repeaters, clone fields and flexible fields. Very good timesaver!
October 23, 2019
I use have their premium version but the free version is great too. I find it to be an immensely helpful tool especially because I tend to be bad with naming fields consistently and end up spelling something wrong. Using this plugin helps prevent those kinds of headaches as the field names are outputted with the PHP theme code. I recommend the pro version if you're using any ACF field groups or repeater fields.
October 3, 2019
From advance to novice user, this is a time saver. Just copy the code and bang.
Read all 22 reviews

Contributors & Developers

“ACF Theme Code for Advanced Custom Fields” is open source software. The following people have contributed to this plugin.

Contributors

“ACF Theme Code for Advanced Custom Fields” has been translated into 5 locales. Thank you to the translators for their contributions.

Translate “ACF Theme Code for Advanced Custom Fields” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.5.0

  • Improve support for WordPress 5.4.
  • Improve support for all field types included in ACF PRO 5.8.9 (including all their various settings).
  • Improve codebase by syncing both free and pro foundations to facilitate faster development cycles and future features.
  • Add escaping to code rendered to bring it in line with recent updates to ACF field documentation. See https://twitter.com/wp_acf/status/1181344882775875584.
  • Add ‘Copy All’ fields button (previously only Theme Code Pro feature).
  • Add various enhancements to code rendered for the following fields and field settings:
    • Gallery field (return types Array, URL and ID)
    • Image (return types Array, URL and ID)
    • File (return types Array, URL and ID)
    • Select (values Single and Multiple, return types Value, Label and Array)
    • Checkbox (return types Value, Label and Array)
    • Radio Button (return type Array)
    • Button Group (return type Array)
    • True / False
    • Link (return types Array and URL)
    • Post Object (values Single and Multiple, return types Post Object and Post ID)
    • Page Link (values Single and Multiple)
    • Relationship (return types Post Object and Post ID)
    • Taxonomy (appearances Checkbox, Multi Select, Radio Buttons and Select, return types Term Object and Term ID)
    • User (values Single and Multiple, return types User Array, User Object and User ID)
    • Google Map
  • Add Location UI and move location related upgrade notice to code block
  • Fix issue with location related upgrade notice where it wouldn’t show if only Options location was selected.

1.4.1

  • Compatibility with WordPress 5.2.2

1.4.0

  • All ACF v5 Free Fields Supported including: Group, Button, Range and Link fields.
  • Fix: Bug with locations section on PHP 7.2

1.3.2

  • Fix: Updated clipboard.js & bug fix for the copy to clipboard feature

1.3.1

  • Fix: Updates to array count functionality for PHP 5.4

1.3.0

  • Core : Support for ACF Pro when bundled in a Theme
  • Fix : HTML output by the File field is now valid
  • Core : Notice for location rule support (now in ACF Theme Code Pro)

1.2.0

  • Core: Quicklinks feature with anchor links to the relevant theme code block
  • Core: Notice updates & various bug fixes

1.1.2

  • Fix: Use the_sub_field method for nested File fields with return format URL

1.1.1

  • Field: Post Object field now works correctly for ACF 4
  • Core: Various internal code improvements

1.1.0

  • Fields: All field formatting improved inline with ACF Theme Code Pro

1.0.0

  • Core: First version