Sneak Peek at ACF Theme Code Pro v1.3

We’ve been working on improvements to ACF Theme Code Pro over the last couple of months. We thought we’d give you a sneak peek at a the new “locations” feature coming in version 1.3.

If you assign a field group to multiple “locations” we allow you to toggle the Theme Code sections to ensure the code that’s generated is relevant to each location, see the example below that’s using the “Options” location!

ACF Theme Code Pro v1.2

We recently released version 1.2 of ACF Theme Code Pro, here’s a summary of the changes!

Clone field improvements

We’ve made some major improvements to the code that’s generated if you’re using the new Clone Field found in ACF Pro. Previously we’d generate a simple variable, we now generate the code for all of the fields or field groups you’ve cloned. If you’re using the clone field we’re keen to hear your feedback!

More third party field support

ACF Theme Code pro now generates code for more third-party fields including:

If you use any third-party fields that you’d like us to support please get in touch!

Variable improvements

In some cases, we generate a variable for your field (for example the image field). Previously, if you used some special characters in your field name our plugin would generate invalid PHP. This version now strips special characters from variable names to ensure only valid PHP is generated.

Bug fixes

This version also includes a few bug fixes for better compatibility with the CPTUI Pro Plugin and a couple of bug fixes for compatibility with PHP version 7.1.

Updating

Version 1.2 of ACF Theme Code Pro can be updated via the dashboard or downloaded from your account.

ACF Theme Code Updates

This week we launched updates to ACF Theme Code (v.1.2.0) and Pro (v1.1.0).

Both versions includes a handy ‘Quicklink’ feature. We now add a ‘code’ link to the actions for each parent field, if you click this it’ll smooth scroll you down to the relevant theme code block.
This is a small feature but ideal for really long field groups, checkout the gif below:

scroll-2

Thanks to @gahawkey for the feature suggestion.

If you have any feature suggestions please please get in touch!

Awesome ACF

Last week we launched a fun little side project awesomeacf.com. It’s a directory of third-party extensions for the awesome Advanced Custom Fields WordPress plugin.

screen-shot-2016-10-21-at-9-51-36-am

Our listings are based on the Awesome ACF GitHub repo that’s not currently maintained, we’ve added a bunch of listings and marked them with the ‘new’ label.

We’ll be adding more listings over time, check it out over at www.awesomeacf.com !

Introducing ‘Your Account’ area

We’ve recently developed a ‘Your Account‘ area here on hookturn.io.

We’ve created accounts for all existing customers & new customers will have an account created for them on checkout. Within the account dashboard you can :

  • Download the latest version of the plugins you have purchased
  • View your Purchase History
  • Download Invoices for your Purchases
  • View your Licence Keys (and expiry dates)
  • Update your contact information & password

Here’s a sneak peak – if you’re an existing customer head over to your account !

screen-shot-2016-09-28-at-6-25-00-pm

The story behind ACF Theme Code

Aaron here, A couple of months ago I was chatting to a good buddy of mine – Ben about an idea I had to save developers time when working with WordPress & the awesome Advanced Custom Fields plugin.

The Problem

It can be time-consuming to implement the fields you’ve created with Advanced Custom Fields, especially if you’re working with a team on a complex project.

Most WordPress developers that I chat to have code snippets, keybindings or other workflow shortcuts that will help create the code they need to implement a particular feature or field (this includes myself up until recently).

Snippets can be great, it means you don’t have to memorise all of the features of an API. I created my own snippets for most of the ACF field types, I’ve used them for the last few years and I’ve had the fun of migrating them each time I switch code editor.

When implementing a field within a WordPress theme, it’s likely I’ll forget the field name, was it ‘profile_image’ or ‘profile_photo’ ? I’m also likely to forget how I’ve set that field to be returned, was it ID, URL or Array ? I found myself constantly editing the field group to find out. I’d then have to remember the shortcut for my snippet to get the code for that type of field with a specific return format. If I was missing a snippet I’d have to jump over and search the ACF docs!

Our Solution

To solve this workflow ‘problem’, Ben & I decided to create (another) WordPress plugin and we called it ACF Theme Code. It generates the code needed to implement ACF in WordPress Themes!

acf theme code pro example

When you publish, edit or update an ACF Field Group, the code required to implement each field is displayed for you in the Theme Code section below the field group settings.The code is based on the ACF documentation, the field names are automatically updated and the code generated changes depending on how you’d like to return a field.

We’ve also included a clipboard feature so you can easily copy these code blocks and paste them into your theme, so our plugin should save you loads of time!

Free & Pro versions

We have a Free version that generates code for all of the fields found in the free version of ACF. The free version of ACF Theme Code is available on WordPress.org, it’s already had over 800 downloads!

We also have a Pro version that generates code for all of the fields within ACF Pro. This includes the complex fields like clone, repeater, gallery and flexible fields. Our Pro version also generates code for a bunch of popular 3rd party fields including the Font Awesome field and Image Crop Field. ACF Theme Code Pro version is available for purchase from this site!

Issues

We ran into a couple of issues along the way, the first one that caught us off guard was due to the way the field group data is stored in the database. The field group data is stored differently in different locations between the free (v4) and Pro (v5) version of ACF. This slowed us down a little but we’re now able to generate code for both the Free and Pro versions of ACF.

Another issue we encountered is regarding field group ‘locations’. You can set a field group to be shown not only on a page or post – but on an options panel, user profile page etc. If that’s the case the code generated will need a couple of tweaks to finalise the implementation. We had this issue partially solved and then we also realised a field group could be set to multiple locations. We’re working on a solution for this one & plan to release a feature to address this soon!

Summary

It’s been a great working with Ben on this plugin, I’m stoked with feedback we’ve received from WordPress developers around the world. I’m looking forward to introducing support for more third-party fields and other developer features in the future!

If you’re interested in finding out more about ACF Theme Code head over to our downloads page.