WordPress Templating Router: Connect custom permalinks to custom templates
The default WordPress Templating Router handles it permalink structure following its own logic. WP Router allows you to link custom templates, at any location, to any custom permalink. For example, you can link the url /custom/ to the template located at templates/custom.php
Thus, WP Router acts as a WordPress templating router. This is particularly useful if you want to include templates that do not follow the logic of WordPress, with it’s post types and archives.
Using WP Router
WP Router can be manually required in your projects, or included using composer. Obviously, WP Router is a script for WordPress.
By creating a new WP Router instance and passing an array with corresponding routes to it, new routes may be registered. The exact procedure is described in the Github repository.
Documentation on the installation and usage of WP Router can be found on Github.
- Connects custom templates to custom urls
- Can be used by themes and plugins
- Useful if you are looking further than posts and pages