Created
December 4, 2015 08:01
-
-
Save AtsushiSuzuki/e4435736a410f1a09820 to your computer and use it in GitHub Desktop.
PHPフレームワークと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 | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$app = new \Silex\Application(); | |
$app->get('/hello', function () { | |
return 'Hello, world!'; | |
}); | |
$app->error(function ($ex) use ($app) { | |
if ($ex instanceof \Symfony\Component\HttpKernel\Exception\HttpException && | |
$ex->getStatusCode() === 404) { | |
return $app->stream(function () { | |
/** | |
* Front to the WordPress application. This file doesn't do anything, but loads | |
* wp-blog-header.php which does and tells WordPress to load the theme. | |
* | |
* @package WordPress | |
*/ | |
/** | |
* Tells WordPress to load the WordPress theme and output it. | |
* | |
* @var bool | |
*/ | |
define('WP_USE_THEMES', true); | |
/** Loads the WordPress Environment and Template */ | |
require( dirname( __FILE__ ) . '/web/wp-blog-header.php' ); | |
}); | |
} | |
}); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment