Support » Plugin: Advanced Custom Fields: Image Crop Add-on » Can’t include within my theme

  • I’m having issues trying to include the plugin within my theme using the code you provided. I did some research and found out that the ‘acf/register_fields’ action has been changed to ‘acf/include_fields’ but I still can’t get it to show up or work with the code below:

    add_action('acf/include_fields', 'my_register_fields');
    
    function my_register_fields()
    {
        include_once( get_stylesheet_directory() . '/_includes/acf-addons/acf-image-crop/acf-image-crop.php');
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey PDidee,

    I ran into this same issue trying to include it in a theme. Try using this instead:

    add_action('acf/include_fields', 'my_register_fields');
    
    function my_register_fields()
    {
        include_once(get_stylesheet_directory() . '/_includes/acf-addons/acf-image-crop/acf-image-crop-v5.php);
    }

    The ‘acf/include_fields’ hook gets called after the ‘acf/include_field_types’ hook which is called in the acf-image-crop.php file to include the field. Since it’s called too late, it never actually loads the new image crop field. That new code should fix the issue.

    Hope this helps!

    • This reply was modified 4 years, 10 months ago by Tanner Record.

    Actually, I just tried to save an image and it looks like some of the javascript is broken (acf-image-crop is looking for the .js in the wrong directory). I’m working on a fix to get a pull request into the project.

    Hopefully this will be fixed in the next couple of days.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t include within my theme’ is closed to new replies.