The Power of Custom Fields

The Power of Custom Fields

What Are Custom Fields?

Custom fields allow you to easily add custom data to posts, pages, or other areas of the database. Where they really start to shine is using them in conjunction with custom post types.

For example, on my IMPbDb website, I use three custom post types: movies, tv shows, and pinball machines. For the pinball machine post type, I have attached several custom fields: game title, manufacturer, year, machine type, number produced, etc.

Some of the custom fields on my pinball machine custom post type.

You can then write your page template to display the data from your custom fields.

Custom fields data displayed on page.

You can even create forms on your site that allow for users to add or edit data from custom fields. It’s quite a powerful tool.

Advanced Custom Fields

The Advanced Custom Fields plugin makes it very easy to add custom fields to just about anywhere on your WordPress site.

For example, on this website, I use ACF to add an excerpt WYSIWYG editor to all my posts. I then show that excerpt when looping my posts on the home page or archive page. You might wonder why I do this when WordPress posts already have an excerpt field. It’s because the WordPress excerpt field is a simple text box, where if I make it a WYSIWYG editor, I can write HTML code in it to do much more advance things. Try creating a hyperlink in the standard WordPress excerpt field and you’ll see what I mean.

I’ve also used ACF on another site, to add a list of followed users to a user’s profile. It does this through the use of a repeater field which can store all sorts of information, but in this case, just a user ID. I can then loop through that custom field to generate a list of any users a particular user follows. Think of it like following another account on Twitter. You probably follow many, you can access a list of them. This allows me to do the same thing.

Custom Field Types

Advanced Custom Fields has field types for just about anything you would need.

  • Range
  • Text
  • Text area
  • Button group
  • Checkbox
  • Radio button
  • Select
  • True / false
  • File
  • Gallery
  • Image
  • oEmbed
  • WYSIWYG editor
  • Color picker
  • Date picker
  • Date time picker
  • Google maps
  • Time picker
  • Accordion

Leave a Reply

Your email address will not be published. Required fields are marked *