Displaying all fields with Custom Field Suite in WordPress

Custom Field Suite is a forked alternative to Advanced Custom Fields. The two work very similar so while looking for a way to render a series of fields for a post, I looked up ACF’s method and found it works great with CFS!

Here’s the ACF method: http://www.advancedcustomfields.com/resources/get_fields/

And here’s an adjusted gist version:

As you’ll see, ACF has a get() method so you use CFS()->get() with no parameters to get all custom fields for the current post. It’ll give you an array. And you just iterate over the array and get() each field by name, then render it.

Advertisements
Displaying all fields with Custom Field Suite in WordPress

One thought on “Displaying all fields with Custom Field Suite in WordPress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s