Using GenerateBlocks in Block Part Templates

GenerateBlocks is a great WordPress plugin that adds some very flexible, power user blocks to your Gutenberg editor experience. It’s one of our go-to block plugins for most block sites we build.

However, it has one major problem. Any blocks created outside of a post or page, like in a template part will not work. This is because GenerateBlocks extracts the post content of the page in order to generate its accompanying CSS.

Add the filter function below somewhere in your code base, like in functions.php of your theme, and adjust the name of $part to be the name of the template part you are using your GenerateBlock in.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.