Home › Forums › General Issues › Distribute ACF with multiple plugins
Hi,
I want to distribute ACF with my theme. I have read the requirements here.
https://www.advancedcustomfields.com/resources/including-acf-in-a-plugin-theme/
I am using the free version of ACF and the the theme is for a unique client, not to be sold / distributed.
My question is. I created 3x plugins using ACF, while my theme also uses ACF.
Will this be the procedure?
1.) Add acf to my wp-content/themes/mytheme/acf
2.) Add the code below to the main file of each plugin which uses ACF
3.) Add the code below to the functions.php of my theme
// 1. customize ACF path
add_filter('acf/settings/path', 'my_acf_settings_path');
function my_acf_settings_path( $path ) {
// update path
$path = get_stylesheet_directory() . '/acf/';
// return
return $path;
}
// 2. customize ACF dir
add_filter('acf/settings/dir', 'my_acf_settings_dir');
function my_acf_settings_dir( $dir ) {
// update path
$dir = get_stylesheet_directory_uri() . '/acf/';
// return
return $dir;
}
// 3. Hide ACF field group menu item
add_filter('acf/settings/show_admin', '__return_false');
// 4. Include ACF
include_once( get_stylesheet_directory() . '/acf/acf.php' );
It seems to be the way to go, except for that I need to change the function for each instance of adding the code.
So changing:
my_acf_settings_path
To:
my_acf_accommodation_settings_path
my_acf_products_settings_path
my_acf_events_settings_path
etc.
Please let me know if I’m on the right track, thank you!
The method you used is designed for ACF PRO version. For the free version, kindly check this page: https://www.advancedcustomfields.com/resources/including-acf-in-a-plugin-theme/?version=4.
Thanks 🙂
@schalkjoubert How has this worked out for you? I’m looking into building a theme with ACF Pro included in it, the same way you are doing. However, I’m concerned that if my theme has ACF included and my customer installs the ACF plugin on their own, it will cause a conflict.
How do you avoid conflict when your plugins include ACF, and your theme includes ACF, and the potential of the customer installing the plugin on their own at some point in time?
Thanks.
The topic ‘Distribute ACF with multiple plugins’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.