WordPress is one monster of a platform, and hacking it is probably as much fun as you can have with a web page without writing actual code. Unfortunately, that little convenience tends to bring out a lot of “Bubba the Web Alchemist” people out the woodworks that go buck wild with plugins and extensions to do some very, very simple things.
One of the biggest Bubba tasks is to use WordPress as a content management system but providing static pages for some parts of the content for one reason or another. While there is a plugin in WordPress 2.1+ to set a page as a homepage, there are also legitimate reasons to have pages in the WordPress powered page that are not part of the WordPress content database. That reason generally involves a third party web designer that doesn’t know how to code WordPress themes, inept content manager and more. Some people design an entire site from scratch then try to muscle WordPress into it. Some people go the opposite way, they start with WordPress but then have content sections they want to manage outside of WordPress content database.
But what if your template elements relied on WordPress functions?
Big gotcha. Suppose you had a flat web page that you wanted to use as a part of your online content but all your headers and footers had WordPress functions in them – to generate category printouts, archives or comments. You couldn’t just use a bare php include because PHP would crash when it couldn’t interpret the function you are trying to call. So, for all of you struggling Bubba alchemists out there, here is the simplest WordPress-aware page using content outside of the WordPress content database:
Bubba the Web Alchemist
The top section sets up the theme and includes the WordPress functions. get_header() gets the overall site header, and the other functions at the bottom (get_sidebar and get_footer) include the sidebar and footer. This can vary based on your template design but it gets the point across.
The part in the middle is the flat HTML you want displayed in the context of your WordPress theme without giving your webmaster a heart attack. They can go about designing the special pages (forms, surveys, internal/external content and more without bothering you or potentially destroying the WordPress deployment in the process.
See, how easy was that?
One Response to WordPress without WordPress