Blog

WordPress Advanced Custom Fields Plugin

Shortly after we finished writing our recent post on the top 10 WordPress Plugins 2011, we came across this little plugin whilst working on a WordPress CMS project. It’s developed by a guy called Elliot Condon, and we found it to be so good that we had to dedicate an entire post to it.

The Advanced Custom Fields plugin is, in one word, brilliant. For anyone looking to extend the functionality flexibility of WordPress as a CMS, without using something as complicated as Pods CMS Framework, it’s perfect.

You can use it to pretty much replace the standard WP ‘Edit’ screen with whatever fields you want. It’s really simple to use, too. Once you’ve created your list of custom fields you then assign that ‘set’ to any number of templates, stick a few bits of code in your HTML, and you’re away!

Getting Started

Once you’ve got it installed you’ll get an ‘Adv Custom Fields’ link under your ‘Settings’ tab, which is where you control the majority of the plugin from. Click this, then ‘Add New’ at the top, and you’re presented with this screen:

From here you can give your field set a name and add all your fields, which include a Field Label, Field Name, Field Type, and Field Instructions (this last one is a great little touch for guiding your clients, or anyone that may be using the CMS in the right direction - be warned though, don’t put anything in there that looks like HTML or you’ll break it!).

The next step is to tell it which template(s) to apply the field set to, and then finally you can choose to turn off any or all of the standard ‘Edit boxes’ on that Template Page. (To be honest I’ve found myself turning the majority, if not all of these off and completely rebuilding the pages with custom fields - it just gives you so much flexibility).

Finally, to add the field content to your template page, it’s as simple as adding the following:

<?php the_field($field_name); ?>

…obviously replacing ‘field_name’ with the name you assigned to that field you want to display.

I won’t go into too much detail because there’s enough information on the plugin website, including some tutorial videos to help get you going.

Oh, and one final thing - this plugin is free. Double bonus!

Addons / Extensions

At the time of writing there are currently two addons available for the small fee of $25 AUD each. This fee grants you use of the addons on unlimited websites, so it’s well worth it, especially considering how useful they are.

The first is the Options Page addon. When enabled this adds a tab, believe it or not, called ‘Options’ to your WP admin, which allows you to create a bunch of ‘site-wide’ fields. This is really useful for things like contact info, which might appear on a number of pages throughout your site.

The second is the Repeater Field addon. This does exactly what it says on the tin and is really useful for creating image galleries and lists of data. It also allows you to limit the number of repeating fields available to your users, but is flexible up to this limit. For example, if you have a limit of 5 then your users can add any number of fields between 1 and 5 depending on how many images / bullet points they want in their list.

The code is very slightly more complicated for this field, but hardly:

<?php if(get_field('gallery_images')): ?>
<?php while(the_repeater_field('gallery_images')): ?>
<img src="<?php the_sub_field('image'); ?>" alt="<?php the_sub_field('alt'); ?>" />
<?php endwhile; ?>
<?php endif; ?>

Conclusion

So far I’ve found absolutely nothing wrong with this great little plugin. It makes a developer’s life very easy and allows you to create very user friendly WordPress content management systems for your clients. In fact I think that’s the main reason I like it so much. It’s user friendly. And for non-tech-savvy clients trying to use WordPress, that’s very important.

Nice one Elliot.

By Chris Skelton

  • http://www.reinaris.nl Rein

    Totally agree, ACF is one of the best plugins for WordPress. Elliot is coming up with new functions in every release, absolutely perfect!

  • http://ilikekillnerds.com Dwayne

    Advanced Custom Fields is one of the best WordPress plugins ever. No other plugin is able to easily do and offer what ACF does and it’s free. I paid $50 for the repeater and options page functionality ($25 each), best money ever spent! I use it for everything.

  • http://www.thosedigitalthoughts.com Chris

    So easy to use. I always hoped for a plugin like this to come out - I have read stories of ppl losing thousands on plugins like flutter.

    The ability to add multiple wysiwig editors is amaxing and he has even moved the uplod media buttons around that make the UI more intuitive. This is the best WP plugin I have used to date. Hopefully something like this will be included one day as core WP functionality.

  • James

    Is it possible to use an advance search for the fields?

  • FightFan

    Plugin is buggy as hell. Has never worked for me and many others. Just browse the ACF forum. Many, many, many posts about the SAME issue and it has NEVER been addressed by author. I would avoid if you want to keep your BP down.

  • http://emptyhead.com.au Matt

    I’ve used it a little and it has worked well for me.

    It did cause a few issues originally because I’d been trying other plugins and also I was not using the specific code.

    Thanks for this article… was really helpful in deciding whether or not to drop the $50 on the addons.

    Cheers

  • http://goodchee.com Lars Faye

    @Fight Fan, you crazy, mang, I haven’t experienced anything of the such and the Forum doesn’t seem any more active with issues than any other plugin I use.

    After trying many of the Custom Field plugins like Flutter, Custom Field Template, Magic Fields and Magic Fields 2 and finally Advanced Custom Fields, I can honestly say there is nothing like ACF out there. Elegant, intuitive, extremely well presented and sleek.

    And (be still my beating heart), there’s actual DOCUMENTATION. I can’t tell you how many times I was left out in the cold with other those other plugins, with either no documentation help or documentation in a completely different language.

    I feel like I was blessed by the WordPress Gods to have found such a straightforward and functional plugin.