# Sage 9, Blade and Buddypress

**URL:** https://discourse.roots.io/t/sage-9-blade-and-buddypress/9604
**Category:** sage
**Tags:** blade, webpack, sage9
**Created:** 2017-05-15T18:24:37Z
**Posts:** 18
**Showing post:** 11 of 18

## Post 11 by @explorier — 2018-09-20T00:36:43Z

Actually I left out some code in the filter that was preventing Sage from correctly loading templates. Here’s the corrected version:

```
add_filter('template_include', function ($template) {

    global $post;

    if(isset($post) && is_a($post, 'WP_Post') && $post->post_type == \MeprProduct::$cpt) {

        $default_template = locate_template( array( 'template-custom.blade.php' ) );
        if ( '' != $default_template
            && '' == $post->page_template // Only when page_template is not set
        ){
            //return $default_template;
            $template = $default_template;
        }
    }

    return $template;
}, 99);
```

---

_[View the full topic](https://discourse.roots.io/t/sage-9-blade-and-buddypress/9604)._
