soderlind / acf-field-date-time-picker

Date and Time Picker field for Advanced Custom Fields v3 and v4
GNU General Public License v2.0
65 stars 27 forks source link

Can't include in plugin #92

Open joshuaiz opened 9 years ago

joshuaiz commented 9 years ago

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!

chimeno commented 9 years ago

same here

cristiancs commented 8 years ago

same

yratof commented 8 years ago

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');
}