Skip to content

Instantly share code, notes, and snippets.

@kayue
Created August 25, 2011 07:05
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kayue/1170134 to your computer and use it in GitHub Desktop.
Save kayue/1170134 to your computer and use it in GitHub Desktop.
Integrate Symfony 2 with Wordpress
<?php
require_once __DIR__.'/../symfony/app/bootstrap.php.cache';
require_once __DIR__.'/../symfony/app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$response = $kernel->handle(Request::createFromGlobals());
// check to see if a route match in Symfony 2
if($response->getStatusCode() !== 404) {
// if do, send continue Symfony 2 app
$response->send();
} else {
// if there is no match, bootstrap and forward to Wordpress
// tells WordPress to load the WordPress theme and output it.
define('WP_USE_THEMES', true);
// loads the WordPress Environment and Template
require('./wp-blog-header.php');
}
@rvanlaak
Copy link

This works great! The only thing lasting is an Twig interface for the wordpress codex functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment