- This topic has 1 reply, 2 voices, and was last updated 1 year, 5 months ago by .
- The forum ‘General Discussion’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
I am trying to create a theme that uses Genesis custom blocks. I want to be able to register a few blocks programmatically when the theme is installed.
The documentation (https://developer.wpengine.com/genesis-custom-blocks/) says that when you want to add a block programmatically you need to use the add_block function from the Genesis namespace
use function Genesis\CustomBlocks\add_block;
add_block( $block_name, $block_config );
I did this and nothing is registered.
I have put the add_block function in my theme directory under /blocks/block-test.php.
I cannot figure out why it is not registering.
Have you added the blocks/blocks-test.php file and path to functions.php ?
Similar to below
require_once get_stylesheet_directory() . '/blocks/block-test.php';
© 2022 WPEngine, Inc.