I’ve been using Symfony for all of my site pages except the blog, which is run with WordPress. Originally I was using a standard WordPress theme that made my blog look different than the rest of my site. I had looked into ways to pull WordPress through a controller action and stuff like that, but ran into difficulties. I ended up using a solution where WordPress functions as normal for the subpath that it is in, but code in a custom theme boots the kernel from the Symfony part of my site and uses the twig service to render the template. Output buffering is used to capture the normal output of the site to pass to twig.
My theme code does some other things, but I will try to present a stripped down version that could work with a Symfony Standard Edition site for the purposes of this post to hopefully help others do the same.
Continue reading post "Symfony templates for WordPress pages"