PHP code example of duncanjbrown / plain-route
1. Go to this page and download the library: Download duncanjbrown/plain-route 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/ */
duncanjbrown / plain-route example snippets
add_action( 'init', function() {
new Plain_Route( 'stripe(/)?', [
'rewrite' => 'p=123',
'pre_get_posts' => function( $query ) {
if( $query->is_main_query() ) {
$query->set('stripe', true);
}
}]);
});
add_action( 'init', function() {
new Plain_Route( 'my-special-template(/)?', [
'template' => 'my-special-template.php'
]);
});