Support » Plugin: Block Lab » Template Not Found

  • Resolved joeconlin

    (@joeconlin)


    I am getting the following error:

    Template file blocks/process-steps/block.php not found.

    Problem is that the file is in that exact location. I think this might be due so me using Sage 9 and Bedrock. I say this because Bedrock changes the location of things although all other plugins and code are working without issue. Is there somewhere I can specify the theme location? I have tried all variations (ie. theme/blocks/blocks-{slug}, etc.) and cannot get it to find the theme.

    Thanks!

    • This topic was modified 1 month, 1 week ago by  joeconlin.
    • This topic was modified 1 month, 1 week ago by  joeconlin.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @joeconlin,
    Sorry to hear the template isn’t loading.

    Sure, you could filter 'block_lab_template_path':
    https://github.com/getblocklab/block-lab/blob/a93d9a7b52b7aadf17d8541770778dfc86a7e610/php/class-util.php#L106

    Here’s a filter you could place in the root of a theme or plugin, and it will then look for templates in the blocks/ directory of that theme or plugin:

    
    /**
     * Adds an alternative path for Block Lab templates.
     *
     * This should be copied into the root of a custom plugin or theme.
     * For example, the plugin could be called block-lab-blocks,
     * And this filter would be in block-lab-blocks/block-lab-blocks.php.
     * Then, place the block templates in block-lab-blocks/blocks/.
     * For example, this could be a template: block-lab-blocks/blocks/block-my-example-template.php.
     *
     * @param string $path The path of Block Lab templates.
     * @return string $path The path of Block Lab templates.
     */
    add_filter( 'block_lab_template_path', function( $path ) {
    	unset( $path );
    	return __DIR__;
    } );
    

    That works perfect! Thank you very much for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.