Disconnect your frontend from WordPress
Almost all of our projects require an admin or content management system at some point. We tend to build our own from scratch to perfectly suit the project’s requirements. However when the budget or complexity doesn’t require it, we turn to our trusty friend WordPress.
WordPress doesn’t have the greatest reputation sometimes, with dodgy plugins leaving sites exposed to hacking and developers struggling with the restrictions of its blogging legacy.
To overcome this we take a slightly different approach to using WordPress in our projects. WordPress is still a winner in client’s eyes because of its polished UI and simplicity. We don’t take any of that away, but we completely disconnect the frontend of WordPress from its admin panel. We don’t use its theming functionality and as a result we are given complete freedom over what we can do with the data, while still giving our clients a great admin experience.
To do this we wrote a PHP wrapper that the frontend uses to fetch the database data at any point, not just when the themeing system allows you to. This means we can choose to include WordPress functionality where it’s needed, rather than blanketing the entire site.
An example of this can be seen in our own site, check out the source code for the team page and try to work out where WordPress comes in. It’s the timeline section, but you’d never know. We’ve used WordPress there to manage our company’s history, but we don’t need it anywhere else, meaning we aren’t shackled to WordPress for the rest of the site. As a result we have the freedom to do some really cool things.
A more extreme example of us using this technique is Raconteur. The entire site is controlled by WordPress, even the interactive pages such as Infographics. Often you can immediately tell if a site is built with WordPress by looking at all the junk it pollutes the header with, but with this method you’re in full control.
When we’ve mentioned this method in the past people have asked how we handle plugins if we aren’t using a theme. If you look at the source code of the plugin you can simply call its internal functions in your own PHP code. This is all it’s doing inside a theme anyway, and often you end up writing your own plugins as a result, reducing the amount of security holes your site might have. We’ve used complex plugins like “advanced custom fields” and “adrotate pro” without any issues using this method. You just need to look at how they are storing their data in the database and go grab it!
Below is a simplified wrapper pulled from our custom framework so you can get started. The code is also on our Github repo.