Check for Custom Block

I am using custom blocks, GitHub - orditeck/sage10-acf-wp-blocks: Composer library for generating ACF Gutenberg blocks from templates for Sage 10.

I have a block built out that will have modals, but I need them to load after the footer. I am trying to check for the custom block but so far I have not had any luck.

From the app.blade.php I am running the has_blocks check. The path does not seem to be working though. Below is what I have tried so far.


If anyone has a suggestion please let me know.

Thanks in advance.

One quick, neat trick is just inspecting that custom block DOM element in the Gutenberg editor.
The data-type attribute of the DOM element is the name of the custom block.


has_block does a simple string comparison on the post content. Which I think means it would use the slug of your block, based on the name passed to the register. I can imagine in this case it is just opco

I haven’t found a use for this before, but it sounds like this might be the case… you might find the Blade directive once and push useful to place content elsewhere in the page, but only once even if you have a block in there multiple times.

1 Like

You may be interested in this example for separate block-specific assets:

1 Like

Have you looked into using the @stacks functionality in Blade templates? Stacks allow you to push code to another view.

There’s a couple of examples out there in case it’s helpful. If you have access to the private discord, @ben posted about using stacks to push scripts to the footer a while back. Radicle also uses that same technique. @MWDelaney also posted an example a few years ago.


Ah, @stacks that was the thing I was trying to think of when I found @once and @push. Thanks for linking to some examples.