A recent thread over on the ThemeForest forums has sparked debate again about the best practices when using shortcodes and custom post types in commercial WordPress themes. Namely, whether these kinds of features should be coded into the theme itself, or if that functionality is better served in a plugin. The likes of Justin Tadlock, Carl Hancock and Pippin Williamson weighed in with their opinions, which favored using shortcodes and CPT’s in a plugin. Several ThemeForest authors showed resistance to this idea, claiming it’s better for business to include them with the theme.
So instead of having the same dialog again and again and again, let me just save us all some time here: They belong in a plugin. For one million reasons, they belong in a plugin. WordPress professionals like Justin, Carl, Pippin and the codex all agree.
Presentation Vs. Functionality: Since the purpose of Themes is to define the presentation of user content, Themes must not be used to define the generation of user content, or to define Theme-independent site options or functionality.
Does your theme include custom post types? Do those custom post types create content? Do not pass go, do not collect $200! So there’s that. Seems pretty straight forward to me.
Obviously CPT’s have their place, I don’t think we need to have that discussion again. But for the sake of small-to-average sized, commercial WordPress themes, why do developers feel like they absolutely must have them?
The never ending 300-style battle for CPT’s in commercial themes has never made much sense to me. That might be because I don’t use CPT’s in my commercial WordPress themes. I never have. I gave up CPT’s when I gave up client work. Back then CPT’s were pretty much a pain in the ass to deal with anyway, so it was an easy decision to make. I knew of the dangers of wrapping up a user’s content in them, but I didn’t have the insight to circumvent the issue with something like a plugin at the time. What a n00b! So my thinking was, I’ll just come up with a way to work with what WordPress gives every user, no matter what kind of setup they have. Enter posts and pages.
I don’t use CPT’s in my commercial WordPress themes.
All of my themes work the same way. Your content, whether it be blog posts or portfolio items, is stored in categorized posts and pages. Weird, huh?! Based on what category you assign, those posts will be used to populate different parts of the theme. This distinction is defined by one of the few theme options I provide. “What category would you like to populate your portfolio with?” And based on their selection, the theme will utilize that to either include or exclude the portfolio, blog posts, etc.
And that’s it, really. Users know how to use posts and users know how to use categories. It’s incredibly straight forward and requires no special treatment of their content on import or export. And given the relatively limited lifespan of a theme, I think this is a fair compromise for the ease of use and portability of content.
Trying to anticipate what every single user is going to do with their content is impossible. On top of that, the skill of the user varies greatly from buyer to buyer. But we can take advantage of some of the constants. There will always be posts, pages and categories. I would argue that users leaving with all of their content in categorized posts and pages is better than leaving with only some of their content and having lost their portfolio because of a theme developer’s mismanagement of their content. Or because they aren’t able to transport that content themselves. The potentiality of a user (let alone a developer) mishandling a CPT is infinite.
Ideally, a user should leave a theme with all of their content, especially if their CPT’s are responsibly transported with a plugin. Some developers are doing this right, most developers are doing it wrong. Even with the developers who are doing it right, there seems to be a lack in standard naming conventions for CPT’s, making the transition that much harder. That’s another post entirely. Standards, amirite?!
The argument can (and has) been made that the separation of content between posts and custom post types, like portfolios, is more beneficial to the user. It’s more intuitive. I can definitely agree with that to an extent. Again, this all depends on the site. I deal with a lot of themes with a portfolio. A user sees a portfolio menu, they assume it’s for the portfolio. A novel concept. But if that portfolio menu wasn’t there, would users lose their shit, run around pulling their hair out and demand a refund? I can tell you from my experiences, they do not exhibit this kind of behavior. They just act like normal people and use the posts and pages with no quarrels because that’s what WordPress is built to do.
In larger sites, where you have tons of posts and pages or content that needs particular treatment or manipulation, you would probably benefit from a CPT or two or ten thousand (you go girl!). It really depends on the site’s purpose and size, and also the user. But for your average commercial WordPress theme user, which is the market I’m dealing with, I don’t feel the need to make that
headache distinction for them by default. These users are creating an average of 5-10 pages and 20-40 posts — a perfectly manageable amount of content, with or without a CPT. And introducing a CPT into that ecosystem seems like an unnecessary distraction to me.
Maybe my absurd use of posts isn’t so crazy after all. It depends on how you define the use of the Posts section. It seems like most people still consider posts to be strictly for use in the blog of a WordPress theme. Rightfully so, since this was the very essence of WordPress for years. But now we’re seeing a definitive shift in how WordPress is being used. WordPress.org defines WordPress as the following:
WordPress started as just a blogging system, but has evolved to be used as full content management system and so much more through the thousands of plugins, widgets, and themes, WordPress is limited only by your imagination.
Even the latest default theme, Twenty Twelve, is setup more like a website than a blog. Of course it has a blog, but for the first time it’s secondary to the homepage. This pivot has been happening for years now, particularly with the popularity of commercial theme marketplaces. Most of these commercial themes provide the layout and styling of a full-fledged website versus just a blog with posts. I keep it real with a few blog-style themes every once in a while, but my focus has also shifted to business style sites, portfolios, and the like.
So based on this pivot, should we limit the use of Posts section to just blog posts? Or are we stuck in the mentality that posts should serve a sole purpose? Posts are incredibly powerful and perfectly manageable on their own, especially if you’re crafty with how you use them. Not utilizing them for something as simple as a portfolio item seems like a waste of core functionality. Especially given headaches that still surround CPT’s in commercial themes.
For me, the disadvantages of CPT’s in commercial themes still outweigh the advantages. And so, for now I’ll carry on without them. That’s not to say that I won’t use them in the future or wouldn’t if the theme called for it. But if I do use them, you better believe they are going to be in a plugin. For now, I don’t see a reason to switch my themes over to using CPT’s.
I’m not trying to use this article to justify whether my practices are right or wrong. Certainly plenty of people will disagree with my methods. What I do know is that this model works for me, and it works for my customers. I’m always experimenting and looking for the best user experience. Of the 10,000+ themes I’ve sold to date, I haven’t had any issues with the method I’ve chosen. No complaints about the lack of CPT’s or the way I handle posts from users switching to my themes, using my themes, or switching away from my themes. Nor do I field any questions about this in the support forum.
We all have ideas about what we think is better for the user, but in the end they will decide what works best for them, and they’ll be plenty vocal if it doesn’t work. I think there’s plenty of room for innovation of how we each use WordPress, as long as we’re respectful of our user’s content.
It’s inevitable that a handful of people will read this and jump to the obtuse conclusion that I’m trying to radically replace the use of CPT’s with standard posts. As I stated earlier, that’s not the conversation we’re having here. CPT’s are incredibly powerful and have advantages that would benefit many situations. My objection is to blindly falling back on CPT’s in widely-distributed commercial themes, when there are potentially simpler, alternative ways to handle content at your fingertips.