Specific route that load a specific template without creating a page

this is what I’m trying to do:

Opening the url http://my-sage-project.3000/portfolio it should use a specific template (for example template-portfolio.blade.php) but without creating a page from WP admin. It has to be just a code thing, without touching the DB

Is it possible in Sage?

This is possible in Sage, because it’s possible in WordPress.

Since this is more about WordPress than about Sage, we recommend giving Stack Overflow a search, or posting your question there. You’ll probably get more thorough help on a question like this!

Hi @MWDelaney
I already tried some solutions but not working, I think, caused by .blade template/ecosystem.

Here something I tried:

add_filter( 'template_include', 'portfolio_page_template', 99 );

function portfolio_page_template( $template ) {

    if ( is_page( 'portfolio' )  ) {
        $new_template = locate_template( array( 'portfolio-page-template.php' ) );
        if ( '' != $new_template ) {
            return $new_template ;

    return $template;

Tried to put portfolio-page-template.blade.php but doesn’t work
Any idea?

Hm, Sage 9 used the soberwp router which allowed customizable routing in WordPress.

Does Sage 10/acorn got a similar mechanism or is there a package that can be included?
OTOH shouldn’t this routing logic rather end up in a site plugin than in the theme?

Specific mechanisms for routing requests are largely beyond the scope of Sage as a framework, especially Sage 9. As @MWDelaney says, WordPress can do it, so you can do it with Sage, but walking you through the process is outside the scope of this forum.

There are a number of ways you can accomplish what you may be trying to do. I would recommend reading the following:

This topic was automatically closed after 42 days. New replies are no longer allowed.