We love Advanced Custom Fields. We use them on pretty much every Word Press project. I’d like to start sharing some tips that I find useful that have to do with the greatness that is ACF.

One thing I like to do when creating a new template file is to organize most of my PHP data towards the top and use it as needed further below.

A standard Word Press template starts life out in the simplest of forms:

If I am creating a template that uses quite a few acf fields, my next step is to call all fields associated with the page:

A lot of people call each field individually via $test = get_field(‘my_field’). While that will work, I prefer to obtain all fields with just 1 variable call. Now any fields for that post ID should be available in array form – aka:

To me, this allows you to quickly scan the top of the template file to see what data is being manipulated instead of having to hunt through a bunch of HTML. It pretty much comes down to user preference on how you want to set up your templates, but I have found this way to be the most efficient.