Last active
December 1, 2016 21:58
-
-
Save collegeman/932a94ef1980e25d760ea904c48ad43b to your computer and use it in GitHub Desktop.
Hypothetical, simpler example of routing in WordPress.
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
<?php | |
$app->get('/author/{id}', function($id) { | |
$posts = get_posts( array( | |
'author' => $id, | |
) ); | |
if ( empty( $posts ) ) { | |
return null; | |
} | |
return $posts[0]->post_title; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment