Skip to content

Instantly share code, notes, and snippets.

@dphiffer
Created July 11, 2013 18:27
Show Gist options
  • Save dphiffer/5977900 to your computer and use it in GitHub Desktop.
Save dphiffer/5977900 to your computer and use it in GitHub Desktop.
<?php
/*
Controller name: Post controller
Controller description: A hacky way to get /api/posts/[id] to work
*/
class JSON_API_Post_Controller {
function error() {
global $json_api;
if (preg_match('#^/api/post/(\d+)#', $_SERVER['REQUEST_URI'], $matches)) {
$_REQUEST['id'] = $matches[1];
}
require WP_CONTENT_DIR . '/plugins/json-api/controllers/core.php';
$core_controller = new JSON_API_Core_Controller();
return $core_controller->get_post();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment