Should Custom Post Types live outside of themes?
Wow it’s nearly a month since my last post! My head is still buried in pixel pushing for some new WordPress themes I’m working on – one of which I hope to publicly release in September – more on that in the coming weeks. One thing that has struck me in a big way over the past few weeks of WordPress development is some of the inherent constraints of Custom Post Types. It is perhaps best explained with a very real example scenario that I’m sure happens all the time.
Take your typical WordPress theme consumer Bob and his wonderful Acme Theme 2010. NOTE: The actors and themes real names have been changed in this post to protect their anonymity
- Bob has been happily using Acme Theme 2010 for the past year. Bob fell in love with Acme Theme’s wonderful Portfolio custom post type which allowed Bob to showcase his excellent photography portfolio. Bob has added a lot of custom post types over the past year. Hundreds in fact.
- Now Bob is not necessarily that tech savvy. Sure he was able to figure out how to buy and install a commercial WordPress theme. It was pretty straightforward actually – WordPress theme installer FTW!
- The Portfolio Custom Posts section immediately showed up after Bob installed Acme Theme 2010 and worked straight away. Bob was a very happy bunny.
- Fast forward 12 months and Bob thinks Acme Theme 2010 is looking a bit stale. That grungy dark theme hasn’t aged well in 2011 and Bob thinks it’s time for a change.
- Bob finds himself a pretty cool brand new FooCorp Reloaded 2011 style theme and thinks it’s wonderful. Sure Acme Theme 2010 has a pretty sweet portfolio feature but FooCorp Reloaded has all these nifty sliders and something called a Ken Burns effect that means Bob drops his 35 bucks for FooCorp Reloaded on the spot and heads on over to WordPress.
- Bob can just about remember the theme install process and goes ahead and installs and activates FooCorp Reloaded 2011. Bob quickly checks the frontend and with a couple of new widgets and sliders setup everything is looking sweet. Bob heads back into WordPress and clicks on the Portfolio feature.
- It’s empty.
- Bob refreshes the screen. Still empty….Something is wrong.
- Bob is now close to mild cardiac arrest. Has he just somehow lost over a years work! Ouch!!
- Bob is now about to kick off a series of support requests with FooCorp and just about anyone he knows who knows anything about what the frick might have just happened his Portfolio collection.
Related posts:
- Why Shortcodes in WordPress themes suck I’ve just spent the last couple of hours troubleshooting a...
Related posts brought to you by Yet Another Related Posts Plugin.















I’ve yet to find a valid use of a custom post type in a WordPress theme that wouldn’t be better served as a plugin. Maybe there are some scenarios where it makes sense. I’ve just haven’t see one yet.Of course, if you’re working on your own site, do whatever you want. But, if your theme is being used by others, put the functionality in a plugin.
Hey Justin thanks for dropping by!The more work I do with Custom Post Types the more and more I tend to agree with you on this. Even for your own site or sites being managed on behalf of clients, theres a high probability that the theme is going to change at some stage and having data structures logic hard coded into theme just seems a bit short sighted.
Ed