Content Management With ACF (Advanced Custom Fields)

Wordpress has been around for many years now and it started mainly as a blogging platform. Today, WordPress is one of the most powerful CMS in the planet and it controls 50-60% of the entire internet in terms of CMS shares. The platform offers a lot of options when it comes to building your site from scratch or via premium themes – the possibilities are endless.
One of the main features of WordPress that made it so successful is via it’s plugin system. Almost every feature you want for a site is available via WordPress plugins be it for security, social marketing, server backups, or interactive components. One of those plugins that is considered a must-have for any WordPress installation is ACF or Advanced Custom Fields. It’s so powerful you can basically create your own page builder just via ACF alone.
What is ACF (Advanced Custom Fields)
To put it simply, Advanced Custom Fields is a plugin that allows WordPress to save any kind of data that you can use anywhere in your site. It can be anything from image urls, dynamic variables (that you can use in your code), or even code fragments! The plugin is mostly designed for developers to make content management easier for their clients – which is a very important thing for us.
How Does It Work?
We can setup fields groups inside WordPress admin that will handle all the dynamic data. Think of it as grouping the data into categories based on where you want to display it in your site. In the screenshot below, we basically setup each field groups based on the site’s pages.
You can categorize all of your site’s data into field groups.
Upon setting up the field groups, you now have the ability to assemble the actual fields that will store all of your dynamic data. In the example below (for the page named “Agency”), we basically setup the fields that will hold all of its contents. This allows clients to reorder and change anything on the page without touching any front end or back end code!
Each custom fields can be re-ordered depending on how you want them to appear in your page.
Field Types
In theory, we can basically use WordPress’ default custom fields to change any content on a page. The only downside is WordPress only supports “plain text” when it comes to its field type which is not very intuitive in terms of content management.
ACF on the other hand gives developers and clients more flexibility by offering many different field types that actually makes sense. For example, we can use an image field type for a page section that displays an image gallery or use the WYSIWYG field type for a page section that only displays articles.
In case you’re looking for a field type that ACF doesn’t support (yet), you can try checking some custom built field types by other developers or even create your own using its extensive API.
The API
The real power of ACF comes from its easy to use programming interface. Setting up the custom fields inside WordPress will only setup the containers for your data, but when it comes to actually displaying it in your site, you have to use its API.
Retrieving the field data is as simple as calling out the field name in your code: get_field(‘field_name’) or the_field(‘field_name’) and It’s up to you how you want to use this data in your site’s front end.
Final Thoughts
We usually develop our own methods when making content management easier for our clients, but with this new tool, we can make their overall experience even better. Not only it gives us developers more options to structure data on the back end, it also gives our clients more control on how their content is being displayed on the front end. You can learn more about this amazing plugin at https://www.advancedcustomfields.com/.