PHP code example of chameleon2die4 / wp-router

1. Go to this page and download the library: Download chameleon2die4/wp-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/ */

    

chameleon2die4 / wp-router example snippets


$router->add_route('wp-router-sample', array(
    'path' => '^wp_router/(.*?)$',
    'query_vars' => array(
        'sample_argument' => 1,
    ),
    'page_callback' => array(get_class(), 'sample_callback'),
    'page_arguments' => array('sample_argument'),
    'access_callback' => TRUE,
    'title' => 'WP Router Sample Page',
    'template' => array('sample-page.php', dirname(__FILE__).DIRECTORY_SEPARATOR.'sample-page.php')
));