diff --git a/README.md b/README.md index c4a501a..02da205 100644 --- a/README.md +++ b/README.md @@ -40,14 +40,23 @@ This add-on can be treated as both a WP plugin and a theme include. 1. Copy the 'acf-image_crop' folder into your theme folder (can use sub folders). You can place the folder anywhere inside the 'wp-content' directory 2. Edit your functions.php file and add the code below (Make sure the path is correct to include the acf-image_crop.php file) -` -add_action('acf/register_fields', 'my_register_fields'); - -function my_register_fields() -{ - include_once('acf-image-crop/acf-image-crop.php'); -} -` +```PHP +/** + * Include ACF Image Crop Addon + */ + + add_filter('acf/image_crop_settings/url', 'my_image_crop_url', 10, 1); + + function my_image_crop_url( $url ) { + + $url = get_template_directory_uri() . '/acf-image-crop/'; + + return $url; + + } + +include( 'acf-image-crop/acf-image-crop.php' ); +``` ## Screenshots ## diff --git a/acf-image-crop-v5.php b/acf-image-crop-v5.php index 66ea326..65b8992 100644 --- a/acf-image-crop-v5.php +++ b/acf-image-crop-v5.php @@ -467,7 +467,7 @@ function get_image_data($field){ function input_admin_enqueue_scripts() { - $dir = plugin_dir_url( __FILE__ ); + $dir = apply_filters( 'acf/image_crop_settings/url', plugin_dir_url( __FILE__ ) ); // // register & include JS @@ -846,7 +846,7 @@ function input_admin_footer() { function field_group_admin_enqueue_scripts() { - $dir = plugin_dir_url( __FILE__ ); + $dir = apply_filters( 'acf/image_crop_settings/url', plugin_dir_url( __FILE__ ) ); wp_register_script('acf-input-image-crop-options', "{$dir}js/options.js", array('jquery')); wp_enqueue_script( 'acf-input-image-crop-options');