Title: Custom Template Path
Last modified: July 1, 2019

---

# Custom Template Path

 *  Resolved [Tibor Paulsch](https://wordpress.org/support/users/tibor/)
 * (@tibor)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/)
 * Hi,
 * I’m trying to customize the default template path for blocks, using the filter
   block_lab_template_path(), but must be doing something wrong. On the front end
   it shows the message that template is missing from the default path. This is 
   how I have used the filter:
 *     ```
       function my_block_lab_template_path($template_path) {
       	$template_path = get_stylesheet_directory_uri() . '/resources/views/blocks/';
       	return $template_path;
       }
       add_filter('block_lab_template_path', __NAMESPACE__ .'\my_block_lab_template_path' );
       ```
   
    -  This topic was modified 6 years, 11 months ago by [Tibor Paulsch](https://wordpress.org/support/users/tibor/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Luke Carbis](https://wordpress.org/support/users/lukecarbis/)
 * (@lukecarbis)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/#post-11690787)
 * Hi Tibor – thanks for reporting this. I’ll take a look as soon as I get a chance.
   Are you getting the template in the editor?
 *  Thread Starter [Tibor Paulsch](https://wordpress.org/support/users/tibor/)
 * (@tibor)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/#post-11691152)
 * Thanks for the quick reply Luke. Editor gives the same ‘Template file /blocks/
   block-name.php not found’ message.
 *  Plugin Author [Luke Carbis](https://wordpress.org/support/users/lukecarbis/)
 * (@lukecarbis)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/#post-11694738)
 * [@tibor](https://wordpress.org/support/users/tibor/) I found the problem.
 * The template path should be the absolute path to the template, not the URI.
 * Also, the template name includes the blocks directory, so your function should
   leave that out. Additionally, no trailing slash is required.
 *     ```
       function my_block_lab_template_path( $template_path ) {
       	return get_stylesheet_directory() . '/resources/views';
       }
       ```
   
 * Obviously, this wasn’t super clear or well documented, so I’ve created a pull
   request to add that information, and support a trailing slash if it happens to
   exist:
 * [https://github.com/getblocklab/block-lab/pull/358](https://github.com/getblocklab/block-lab/pull/358)
    -  This reply was modified 6 years, 11 months ago by [Luke Carbis](https://wordpress.org/support/users/lukecarbis/).
    -  This reply was modified 6 years, 11 months ago by [Luke Carbis](https://wordpress.org/support/users/lukecarbis/).
    -  This reply was modified 6 years, 11 months ago by [Luke Carbis](https://wordpress.org/support/users/lukecarbis/).
 *  Thread Starter [Tibor Paulsch](https://wordpress.org/support/users/tibor/)
 * (@tibor)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/#post-11695112)
 * Thanks Luke! Makes sense and works like a charm now.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom Template Path’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/block-lab_5c34e8.svg)
 * [Block Lab](https://wordpress.org/plugins/block-lab/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/block-lab/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/block-lab/)
 * [Active Topics](https://wordpress.org/support/plugin/block-lab/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/block-lab/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/block-lab/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Tibor Paulsch](https://wordpress.org/support/users/tibor/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/custom-template-path/#post-11695112)
 * Status: resolved