• I’m developing a WordPress theme with a very focused use case. I’m trying to help some local non-profits improve their web presence. I want to make the process as straightforward and with as little extra installation steps as possible. As a result I’m forgoing using ACF or any exterior plugins as much as possible.

    I have some custom Gutenberg blocks as a plugin. I want to include them in my theme. This is not working. How can I get it to register the gutengberg blogs from the theme?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I just followed the guide at https://www.advancedcustomfields.com/resources/blocks/

    As this relates to a commercial plugin, please use their official support channel. We feel they are best equipped to support their products.

    https://www.advancedcustomfields.com/support/

    Commercial products are not supported in these forums.

    Thread Starter Aslan French

    (@thedonquixotic)

    @sterndata Sorry, I’m not asking about how to include ACF in my theme. I’m asking how to include Gutenberg blocks in my theme.

    I made a plugin that registers custom gutenberg blocks.

    I want to include it in my theme so that when the theme is install the blocks also become available without also having to install a separate plugin.

    I am aware why this is not the recommended strategy by WordPress as it carries with the risk of theme lockin and making a website break content when the theme is changed.

    But that’s not a concern in my use case and I am trying to make an install process more seamless. That’s my priority.

    Thanks.

    Thread Starter Aslan French

    (@thedonquixotic)

    I have tried adding the following code to my function.php and it should work but it does not seem to be.

    I know the js and css files are all fine because the only thing I’m doing is copying the working plugin folder into my theme folder and then trying to enqueue the scripts from there.

    add_action( 'enqueue_block_editor_assets', 'block05editor_scripts' );
    
    function block05editor_scripts() {
    	wp_enqueue_script(
    		'block05editor_scripts',
    		get_stylesheet_directory() . '/Jackalope-Gutenberg/05-media-block/block.build.js',
    		array( 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-components' ),
    		''
    	);
    
    	wp_enqueue_style(
    		'block05editor_styles',
    		get_stylesheet_directory()  . '/Jackalope-Gutenberg/05-media-block/editor.css',
    		array(),
    		''
    	);
    }
    
    //- ADD BLOCK ASSETS FOR FRONTEND
    add_action( 'enqueue_block_assets', 'block05frontend_styles' );
    
    function block05frontend_styles() {
    	wp_enqueue_style(
    		'block05frontend_styles',
    		get_stylesheet_directory()  . '/Jackalope-Gutenberg/05-media-block/style.css',
    		array(),
    		''
    	);
    }
    • This reply was modified 5 years, 2 months ago by Aslan French.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I include some custom Gutenberg blocks in a custom theme?’ is closed to new replies.