Create a gist now

Instantly share code, notes, and snippets.

<?php
function my_test() {
$returnVal = array(
'title' => 'My Title',
'content' => 'This is my content from the first example.'
);
return $returnVal;
}
add_action('mr_register_route', function() { MRouter::addRoute('test', 'my_test'); });
<?php
if ( ! class_exists( 'RouterTester' ) ) {
class RouterTester {
function __construct() {
MRouter::addRoute('testing', array(&$this, 'testing'));
}
public function testing() {
$returnVal = array(
'title' => 'My Second Route',
'content' => 'This is content for my second example.' );
return $returnVal;
}
}
}
if ( ! @$RouterTester && function_exists('add_action')) {
add_action('mr_register_route', function() { $RouterTester = new RouterTester(); });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment