Themosis Framework for WordPress: Template Routing

I’m using the Themosis framework for WordPress and am trying to figure out how to use the template routing.

I’m basing this off of the routing docs

Read More

The template slug is set in the app/config/templates-config.php:

return array(

    /*
    * Edit this file in order to configure your page
    * templates.
    *
    * Simply define a template slug.
    */

    'custom-template'

);

Then I set the following in the routes.php:

Route::get('template', array('custom-template', function(){

    return 'This will handle the custom-template slug...';

}));

But that just gets me a 404 error when I go to domain.dev/custom-template. Not sure how to make it work so that I can set up a custom template.

Related posts

1 comment

  1. The templates defined inside the templates.config.php file are WordPress page templates. This means that you have to create a page, from WordPress admin, and assign your custom-template to that page.

    So if you create a page with a title of About Us, the page URI is about-us. Assign the custom-template to your page from the Templates metabox (or Themosis Templates depending on your version) and visit the address at “http://yourdomain.com/about-us/” => This triggers the template route you defined.

    So this route is called for all pages that have the custom-template assigned to them. The template slugs won’t create any URI segments.

Comments are closed.