1. Go to this page and download the library: Download alpipego/awp-router library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alpipego / awp-router example snippets
$dispatcher = new \Alpipego\AWP\Router\Dispatcher();
$dispatcher->custom->get('/my-custom-route', function(WP_Query $query) {
// do something with your query
});
// public function condition(callable $condition, callable $callable);
$dispatcher->template->condition(function(WP_Query $query) {
// if this is true
return $query->is_page;
}, function(WP_Query $query, string $template) {
// then execute this
return $template;
});