How to use Advanced Custom Fields for better WordPress content strategy

Setting the stage

A fresh WordPress install provides you with title, body content, featured image, tags and categories to fill in when creating new posts(just title and body content for pages). That may be all you need for a blog post but page and custom post templates can really benefit from having more fields to play with. In 2011 we started using Elliot Condon’s Advanced Custom Fields(ACF) and it revolutionized how we organized the content and structure of our WordPress themes. ACF is a huge timesaver for custom field creation and is very easy to use for both content creators and developers.

Wordpress already has custom fields

If you are familiar with WordPress you may be thinking “Hey, doesn’t WordPress already have custom fields?” and you would be right. WordPress out-of-the-box has custom fields(post meta) that are limited to just a name(to reference the field) and a plain text value. The simple custom field could work perfect if you just need a quick field for something like a Part Number on a Parts custom post, but imagine with me for a minute you wanted a more robust structure for Parts content set up like this:

  • Part Name(Title)
  • Part Description(Body Content)
  • Part Manufacturer(A custom taxonomy)
  • A photo of the part(featured image)
  • Part Number
  • A link to buy the part at amazon or another site
  • Image of the part in action
  • Part manual PDF file
  • Part technical specifications

Having the details about a particular piece of content(in this situation a Part) broken into individual fields makes it easier for you to manage the content and also gives us a lot more flexibility with how the template is designed for the part. If we had all of that extra information stuffed into the main Part Description field the visual design would suffer and we could expect inconsistencies from one part to the next. The specific fields for each piece of information(meta) provides a structure to both the content itself and the template that your valuable customers are going to see on the front end of your website.

How does it work?

ACF actually takes that basic custom field functionality that is standard in WordPress and expands upon it. The data you store in ACF will be found inside the post meta in the WordPress database which comes in handy when we need to sort or search the data stored in the ACF fields.

A field group(collection of fields for a particular area of your site) can be associated with a specific post type, a page template, a user, a taxonomy term, an options page(handy for site-wide content) and more. So you can use fields XYZ in one area of your site and fields ABC over in another area.

ACF field types!!!

One of the best features of ACF is that there are so many field types available right off the bat. WordPress basic custom field is only a plain text field, but ACF has all of these:

  • Text
  • Text Area
  • Email
  • Url
  • Password
  • Wysiwyg Editor
  • oEmbed
  • Image
  • File
  • Gallery(Pro Only)
  • Select
  • Checkbox
  • Radio Button
  • True / False
  • Post Object
  • Page Link
  • Relationship
  • Taxonomy
  • User
  • Google Map
  • Date Picker
  • Color Picker
  • Message
  • Tab
  • Repeater (Pro Only)
  • Flexible Content (Pro Only)

That may seem like a lot of fields, and in our Parts example we would only be using a few of them, probably like this:

  • Part Number(Text or Number)
  • A link to buy the part at amazon or another site(Url)
  • Image of the part in action(Image)
  • Part manual PDF file(File)
  • Part technical specifications(WYSIWYG)

If ACF does not have the field type that you require for your content, there is a variety of other custom fields that developers have created or we can create a new field type from scratch to meet your specific needs. Some fields (and the Options Pages ability) are only available in ACF Pro but the amount of time saved during development and content management is well worth the small investment into the paid plugin.

ACF Repeaters and Tabs

Some of the ACF field types aren’t actually used for storing content themselves, they are more like a container or group to organize your content fields. Fields can be put into organized Tabs so that you don’t end up with a long page of unrelated fields. We use Repeater fields all the time to create a “Row” of empty fields that can be essentially duplicated as many times as needed.

When sliders were all the rage for homepages (Are we past that yet???) we would use ACF all the time for managing the slide content.
Each slide could have a title, background image, callout button and a callout link. The site administrator could click Add Slide and immediately get to adding that the content for the slide. Inside the Repeated field the Rows could be rearranged by simply dragging and dropping them into the desired order.

The magical relationship field

The relationship field can bridge one post to other posts(or other post types). We have used the relationship field for doing things like allowing you to set related posts to the current blog post or creation a relationship between a product post and a part post. The best thing about the relationship is that it goes both ways. We can show the parts that a related to a product(when viewing the product) or show the products that are related to a part(when viewing the part) by using a special meta query.

What can ACF do?

Over the last few years we have used ACF in dozens of different ways:
slider content, homepage layouts, person/staff meta details, product catalogs, and even as the configuration settings for custom plugins. Over and over again we use ACF’s field structure to break the page content into clear sections that we can consistently style on the front-end.

What if I don’t want to use ACF?

There are alternatives to using ACF if you are looking to improve your content structure and use custom fields in meaningful ways. CMB2 is a developer-friendly alternative that offers a lot of field types but fields creation is done in the plugin/theme code and not using a backend admin interface. PODS framework is a user-friendly plugin for adding new post types and custom fields to your site. If you are familiar with pre-built themes you may have noticed that a lot of them have custom visual content editors that typically use shortcodes to create rows, columns, tabs, etc all stuffed into the default WordPress content field. This makes sense for stock themes that have to be versatile to fit all kinds of content but when creating custom themes we definitely recommend ACF to structure content in meaningful and user-friendly ways.

Further reading

The official documentation(awesome)
WordPress standard Custom Fields

Reach out to us if you want to learn more about how using ACF can improve your WordPress site or even if you have a question about how to do something using ACF.