ACF Extended requires Advanced Custom Fields Pro. If you also bundle ACF Pro, make sure it is included before ACF Extended. See ACF Pro documentation.
To include ACF Extended within your theme or plugin, download the plugin files and copy them into your theme or plugin.
In this example, ACF Extended plugin folder is copied into /my-theme/includes/acfe/. The file acf-extended.php must sit directly in /my-theme/includes/acfe/acf-extended.php:
wp-content/
└── themes/
└── my-theme/
├── includes/
│ └── acfe/
│ ├── assets/
│ ├── includes/
│ ├── lang/
│ ├── acf-extended.php
│ └── readme.txt
├── functions.php
├── index.php
└── style.cssNext, use the following code in your functions.php file as a starter to customize and include the ACF Extended plugin into your plugin or theme.
// define path and URL to the ACFE plugin
define('MY_ACFE_PATH', get_stylesheet_directory() . '/includes/acfe/');
define('MY_ACFE_URL', get_stylesheet_directory_uri() . '/includes/acfe/');
// include the ACFE plugin
include_once(MY_ACFE_PATH . 'acf-extended.php');
// customize the url setting to fix asset URLs
add_filter('acfe/settings/url', 'my_acfe_settings_url');
function my_acfe_settings_url($url){
return MY_ACFE_URL;
}If your website uses a parent / child theme setup, ACF Extended can be included in either of them. The only difference is the WordPress function used to build the path and URL.
wp-content/
└── themes/
├── parent-theme/
└── child-theme/
├── includes/
│ └── acfe/
│ ├── acf-extended.php
│ └── ... (rest of the files)
├── functions.php
└── style.cssAdd the following code in the child theme functions.php file:
// define path and URL to the ACFE plugin (child theme)
define('MY_ACFE_PATH', get_stylesheet_directory() . '/includes/acfe/');
define('MY_ACFE_URL', get_stylesheet_directory_uri() . '/includes/acfe/');
// include the ACFE plugin
include_once(MY_ACFE_PATH . 'acf-extended.php');
// customize the url setting to fix asset URLs
add_filter('acfe/settings/url', 'my_acfe_settings_url');
function my_acfe_settings_url($url){
return MY_ACFE_URL;
}wp-content/
└── themes/
├── parent-theme/
│ ├── includes/
│ │ └── acfe/
│ │ ├── acf-extended.php
│ │ └── ... (rest of the files)
│ ├── functions.php
│ └── style.css
└── child-theme/
├── functions.php
└── style.cssAdd the following code in the parent theme functions.php file. Note that it uses the template functions instead of the stylesheet ones:
// define path and URL to the ACFE plugin (parent theme)
define('MY_ACFE_PATH', get_template_directory() . '/includes/acfe/');
define('MY_ACFE_URL', get_template_directory_uri() . '/includes/acfe/');
// include the ACFE plugin
include_once(MY_ACFE_PATH . 'acf-extended.php');
// customize the url setting to fix asset URLs
add_filter('acfe/settings/url', 'my_acfe_settings_url');
function my_acfe_settings_url($url){
return MY_ACFE_URL;
}Using get_stylesheet_directory() in a parent theme would look for the plugin in the child theme folder, which results in a fatal error on the include_once and broken asset URLs.
Keep in mind that WordPress loads the child theme functions.php before the parent theme one.
Never include ACF Extended in both themes at the same time.