Support

Account

Forum Replies Created

  • Trying again…

    Using this ACF forum post I found how to load scripts via file name in blocks.json. Which is great as I understand it’s the better way to do it (now that it’s possible) instead of what Bill Erickson’s tutorial shows.

    So @spinline since you are loading a JS file named custom.js you’d need to add in the same folder a file named custom.asset.php. In this file you can include the handle name, dependencies, and version number. Or you can leave them to be default generated. My js-file-name.asset.php looks like this:

    
    <?php
      return array(
        'dependencies' => array(
            'wp-blocks',
            'wp-element',
            'wp-i18n',
        ),
        'version'      => '1.0',
      );
    

    To read more about this, check out the WPDefinedAsset section in the Block Editor Handbook.

  • I had the same problem of my block JS file not loading when adding it this way. If you have wp_debug enabled you’ll probably see this notice: “Function register_block_script_handle was called incorrectly…”. It will show the name of the .asset.php file it’s expecting.

    However, using this ACF forum post to start, I found how to load scripts via file name in blocks.json. Which is great as I understand it’s the better way to do it (now that it’s possible) instead of what Bill Erickson’s tutorial shows.

    So @spinline since you are loading a JS file named custom.js you’d need to add in the same folder a file named custom.asset.php. In this file you can include the handle name, dependencies, and version number. Or you can leave them to be default generated. My js-file-name.asset.php looks like this:

    `
    <?php
    return array(
    ‘dependencies’ => array(
    ‘wp-blocks’,
    ‘wp-element’,
    ‘wp-i18n’,
    ),
    ‘version’ => ‘1.0’,
    );
    `

    To read more about this, check out the WPDefinedAsset section in the Block Editor Handbook.

  • I had the same problem of my block JS file not loading when adding it this way. If you have wp_debug enabled you’ll probably see this notice which will show the name of the .asset.php file it’s expecting:

    “Function register_block_script_handle was called incorrectly…”.

    However, using this ACF forum post to start, I found how to load scripts via file name in blocks.json. I understand this is the better way to do it (now that it’s possible) instead of what Bill Erickson’s tutorial shows (enqueing the script manually via PHP).

    So since you are loading a JS file named custom.js you’d need to add in the same folder a file named custom.asset.php. In this file you can include the handle name, dependencies, and version number. Or you can leave them to be default generated. My js-file-name.asset.php looks like this:

    
    <?php
      return array(
        'dependencies' => array(
            'wp-blocks',
            'wp-element',
            'wp-i18n',
        ),
        'version'      => '1.0',
      );
    

    To read more about this, check out the WPDefinedAsset section in the WP Block Editor Handbook.

  • I had the same problem of my block JS file not loading when adding it this way. If you have wp_debug enabled you’ll probably see this notice which will show the name of the .asset.php file it’s expecting:

    “Function register_block_script_handle was called incorrectly…”.

    However, using this ACF forum post to start, I found how to load scripts via file name in blocks.json. Which is great as I understand it’s the better way to do it (now that it’s possible) instead of what Bill Erickson’s tutorial shows.

    So @spinline since you are loading a JS file named custom.js you’d need to add in the same folder a file named custom.asset.php. In this file you can include the handle name, dependencies, and version number. Or you can leave them to be default generated. My js-file-name.asset.php looks like this:

    
    <?php
      return array(
        'dependencies' => array(
            'wp-blocks',
            'wp-element',
            'wp-i18n',
        ),
        'version'      => '1.0',
      );
    

    To read more about this, check out the WPDefinedAsset section in the Block Editor Handbook.

  • I had the same problem of my block JS file not loading when adding it this way. If you have wp_debug enabled you’ll probably see this notice: “Function register_block_script_handle was called incorrectly…”. It will show the name of the .asset.php file it’s expecting.

    However, using this ACF forum post to start, I found how to load scripts via file name in blocks.json. Which is great as I understand it’s the better way to do it (now that it’s possible) instead of what Bill Erickson’s tutorial shows.

    So @spinline since you are loading a JS file named custom.js you’d need to add in the same folder a file named custom.asset.php. In this file you can include the handle name, dependencies, and version number. Or you can leave them to be default generated. My js-file-name.asset.php looks like this:

    
    <?php
      return array(
        'dependencies' => array(
            'wp-blocks',
            'wp-element',
            'wp-i18n',
        ),
        'version'      => '1.0',
      );
    

    To read more about this, check out the WPDefinedAsset section in the Block Editor Handbook.

  • Good ideas for the CSS workaround! Nice and clean. But just a note, the above code has an extra space in it. I believe it should be something like:

    .acf-block-preview.wp-block-your-block-name a {
      pointer-events: none;
    }
    
  • Hey @cr0ybot have you tried this again recently? I just did and was definitely able to add an SVG icon without the plugin or extra effort. I was able to just drop in the SVG code. Custom category icons are still a pain, but that’s not an ACF thing of course, but WP itself.

  • An update for anyone coming here now… For me I had no issues adding an SVG icon as per the ACF docs (no plugin needed). Now if you are adding an icon for a custom category, that’s a whole other thing and not as easy. But for a just a custom ACF block, I could drop in the SVG code no issues.

  • Hey Elliot, nice to see you jumping in on this. I was in the process of editing my ACF version as you mentioned, but upon checking for updates I see you posted a new version, 5.5.14, maybe in an effort to force other installs to update. Anyway, just to be sure I changed my version and then updated ACF.

    Bad news though, it did NOT work for me. Bummer. John’s original simple filter how did work, so I’m going back to that for now, as it continues to work and so far not cause issues with my WooCommerce install.

  • Note, I am happy to provide full access to a staging site to help triage this, it’s a pretty mission critical bug for me. Thanks!!

  • Same JS error for me too using 5.5.13. But I am using a Flexible Content field. And the issue seems to any layout with a clone field.

    I get the error when trying to “add new layout” in the custom fields editor. I get the same error when using the layout button to add a layout to a page if it’s any of my layouts with the clone field.

    UPDATE: I tried rolling back to 5.5.11, but it still doesn’t work. Which is weird because it did work at some point, I had the layout added to my page that I can no longer add.

    NOTE: Download link for 5.5.12 looks to be actually v5.5.13

  • This plugin no longer works properly with latest ACF version.

    Ideally this topic should be re-opened maybe? Personally I think this functionality would be a great addition to ACF and would make tab usage much more functional and avoid significant field group duplication in order to keep all the tabs together.

    Thanks!!

  • I can recreate this same issue where if I click to “Update” a page it does not save. It’s a long shot but I have 100% narrowed it down to this plugin causing the issue for me: Pagely MultiEdit.

    The issue occurred on a client site and on a clean test instance of WP I setup. If ACF + MultiEdit is active, then the page no longer saves. The issue is reported here: https://wordpress.org/support/topic/content-disappearing-from-tabs?replies=7

    If either ACF or MultiEdit is deactivated then the pages saves fine. Hope this might be the issue for folks!

  • Hi Elliot,

    Sorry, just want to clarify that means you are still planning on doing the Widget add-on you speak of here, http://old.support.advancedcustomfields.com/discussion/6147/acf-widgets-add-on/p1 ?

    That would be epic if so! Widgets are still often either a pain to customize or a pain for low tech clients who have to fumble around with code if you don’t customize widgets for them. Having widgets with ACFs in them instead would be huge!

    Thanks,
    Trevor

Viewing 14 posts - 1 through 14 (of 14 total)