How to enable or change Advanced Custom Fields (ACF)

There are two options, depending on what you want to do with ACF:

  • if you just want to display the ACF settings in the admin area and add your own ACFs, or
  • if you want to edit the existing ACFs that come with the theme

For the first option you just have to go to Appearance -> Customize -> Theme Options -> Other and there you will see the option Show ACF admin panel, that you can set to yes, to display the ACF menu in the Admin dashboard side menu.

In order to edit the existing ACFs that come with the theme you will have to change some code in the theme and also import the existing fields. So there is a bit more work to be done, so let’s take a look what needs doing:

  1. display the ACF menu – set the Show ACF admin panel to yes in Appearance -> Customize -> Theme Options -> Other,
  2. open the wp-config.php file of your WordPress website on your server and add these two line of code to it:
    define( 'PT_DEVELOPMENT', true );
    define( '<Your theme name goes here>_DEVELOPMENT', true );

    So if you are using the CargoPress theme you would add this line:
    define( 'CARGOPRESS_DEVELOPMENT', true );Note: setting the development constant to true might also affect the loading of some resources in the theme. Usually the unminified version of the main.js file is loaded in the development mode.

  3. And finally you have to import the ACFs:
  • Get the XML or JSON file from the theme folder (unzip the theme zip file and open the bin folder),
  • If your theme has a JSON file, go to Custom Fields -> Tools and import the JSON file there. That’s it. All done.
  • If it has the XML file, go to Tools -> Import and follow the steps below
  • Click on WordPress (and install the plugin WordPress Importer if you don’t have it already)
  • Select the xml file that you downloaded and click on Upload file and import
  • in the second step click on Submit
  • Now click on Custom Fields in the Admin dashboard menu and check if the ACFs have imported

Now you can make changes to the ACFs that come with the theme.