-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00df204
commit 75de693
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Wordpress virtual routes | ||
|
||
### How to use | ||
1. Add an action to wp_virtual_routes that recieves RouterInterface as a parameter. | ||
2. Add new route with $router->addRoute(); As a param pass RouteInterface type. | ||
* new Route(); | ||
* First param ir route url. Example: '/users/login' | ||
* Second param is of type RouteHandlerInterface. You can extend the RequestHandler class to create your own handler or just pass in RequestHandler | ||
with a defined template param to create a simple page that renders your specified template. | ||
* Third is page title. Example: 'User login form' | ||
``` | ||
add_action('wp_virtual_routes', function (RouterInterface $router) { | ||
$router->addRoute(new Route('/users/login', new LoginHandler(), 'User login')); | ||
$router->addRoute(new Route('/users/profile', new RequestHandler('views/user-profile.blade.php'), 'User profile')); | ||
});``` |