Hey folks!
I’ve been enjoying Sage 10 since it launched, but I’ve come to a difficulty and the subject doesn’t seem to have been brought up already.
I’m working on a site where I need to use a specific blade template for a section of the site (tech specs of products) not related to any post type (singular) or common WP stuff (home, search, archive…) as I’m using tables already existing that were not created for Wordpress.
I’m using add_rewrite_rule() for the custom URL structure and to populate new query_vars, but then I don’t know how to load the blade template I need.
On a basic WP theme I would be creating a “specs.php” file at the root of the theme and load it from a “template_include” filter, but with Sage 10 I don’t know what the best practice would be.
So obviously, this does not work, as it is expecting a PHP file location and not a view:
add_action('template_include', function () {
if ( get_query_var('view') == 'specs' ) {
return view('specs');
}
});
Or should I use a ThemeServiceProvider ?
Any ideas how to do that?
Thanks!