Hey Roberto, I am OK with you doing this. In general I think bundling plugins in themes/other plugins is bad practice as it often leads to plugins becoming out of date as they are not included in the WordPress plugin management system where people typically get their updates.
However this was a common enough request and common pattern used in ACF that I did make modifications to allow this plugin to be bundled with themes. I think the same method would probably work for you in your plugin, although I have not tested it myself. You can find the instructions for doing so here: https://wordpress.org/plugins/advanced-custom-fields-font-awesome/#installation
I’ve written in some functionality as a ‘fail safe’ to try to handle situations where this plugin was bundled and is out of date. It will alert the users that a new version is available through a message at the top of the wordpress admin plugins page letting them know to contact the theme author for updates. You should modify this text with the provided filter to instead reference your plugin as the source of the out of date version.
Also if the user decides to install the latest version of my plugin from the WP repository, it will load that version instead of the version bundled in a theme (or in your case plugin), offering users a path to still update if they are not able to get updates from the theme (or plugin) where they initially got this plugin from.
Hi, thanks for your reply and availability. For each new version of my plugin I will also add the updated version of your plugin. I followed your instructions but without success as the “font awesome” field is not displayed. Below I write the two attempts made. I added the codes inside the main file of my plugin (where the ACF inclusion is present)
== First test ==
define( ‘MY_ACF_FONT_AWESOME_URL’, plugin_dir_url( __FILE__ ) . ‘/includes/advanced-custom-fields-font-awesome’ );
include_once( MY_ACF_FONT_AWESOME_PATH . ‘acf-font-awesome.php’ );
== / First test ==
== Second test ==
include_once( plugin_dir_url( __FILE__ ) . ‘/includes/advanced-custom-fields-font-awesome/acf-font-awesome.php’ );
== / Second test ==
Can you support me, please?
I’m sorry, my first attemp is:
define( ‘MY_ACF_FONT_AWESOME_URL’, plugin_dir_url( __FILE__ ) . ‘/includes/advanced-custom-fields-font-awesome/’ );
include_once( MY_ACF_FONT_AWESOME_URL . ‘acf-font-awesome.php’ );
This is getting a bit outside of where I want to be providing support as this is a pretty non-standard use case. But to hopefully point you in the right direction here are a few thoughts that come to mind:
- Make sure those paths are valid. Lots of way to do this. One way would be to use “require_once” instead of “include_once” so that if the path fails you will get a PHP fatal error.
- Assuming the paths are valid, you may be running into a timing issue. Are you firing this code within an action hook? Or is it just loading as soon as your plugin loads? I would consider firing that code on the ‘after_setup_theme‘ or ‘setup_theme‘ actions as that is fired right after/before WP reads the theme functions.php. That would pretty closely resemble how this code was designed to be used.
- Some other timing issue perhaps, loading it too late?
And of course all the typical stuff applies, make sure you have wp_debug on and are looking for any errors in your php_error log.
You can put debugging lines into my code temporarily to make sure it is being executed.
Hi, thank you very much for your support. I solved with the following code:
include_once(plugin_dir_path( __FILE__ ) . ‘includes/advanced-custom-fields-font-awesome/acf-font-awesome.php’);
plugin_dir_path instead of plugin_dir_url
Have a good day
Ah yes that would do it. Glad you got it resolved.
Hi, my intention is to release my plugin both on the WordPress repository and a paid version(on a market place). With your plugin’s current license, can I do this? do you expect a commercial license? Thank you
I think you are probably venturing into some grey area. You should probably hop on the WordPress slack channel and talk with the plugin review team before you get much further. I am not sure what kind of policies are in place about bundling another plugin from the repository in your own plugin.
If I were in your shoes I would take efforts to avoid that situation. I’d recommend you think about that area of your plugin with the FontAwesome field selection as something that becomes available if/when the user installs and activates this plugin. You can just detect in your code if the FontAwesome field is available, and show the icon selection. If it isn’t available you can show your users a message recommending they install the plugin to enable that feature.
This will make the codebase size that you need are responsible for smaller. It will ensure that your users are able to get updates to this plugin as soon as they become available. And it will avoid the grey area you are entering in with bundling other plugins in your own plugin in the WP repository.
This reply was modified 1 month, 1 week ago by Matt Keys.