acf-field-date-time-picker icon indicating copy to clipboard operation
acf-field-date-time-picker copied to clipboard

Can't include in plugin

Open joshuaiz opened this issue 9 years ago • 3 comments

Hello,

I'm using the date time picker in a plugin and using your include function is not working.

I've included acf in the plugin in a subdirectory of my plugin folder: '/acf/'

Then using your code in my main plugin file:

 add_action('acf/register_fields', 'my_register_fields');

 function my_register_fields()
 {
      include_once( plugin_dir_path(__FILE__) . '/acf/acf-date_time_picker/acf-date_time_picker.php');
 }

I've also tried using the action hook: 'acf/include_fields' but no joy. Even using an explicit url to the file does not include it. Are you sure all the functions are correct for ACF v5?

If I place the plugin in the plugins directory and activate it it works as normal but obviously it is not ideal to require plugin users to download and install a separate plugin.

Would love to get this included properly. Am I doing something wrong?

Thanks!

joshuaiz avatar Jul 05 '15 16:07 joshuaiz

same here

chimeno avatar Oct 27 '15 08:10 chimeno

same

cristiancs avatar Jan 07 '16 20:01 cristiancs

If you're using ACF5 @chimeno @cristiancs, the documentation is wrong. You need to replace acf/register_fields with acf/include_field_types

You should end up with something like this:

add_action('acf/include_field_types', 'acf_date_time');
function acf_date_time() {
  include_once( plugin_dir_path(__FILE__) . '/acf/acf-date_time_picker/acf-date_time_picker.php');
}    

yratof avatar May 19 '16 20:05 yratof