I just gave the post ‘Shortcodes Should Never be Included With Themes. Period.’ by Leland Fiegel at ThemeLab a read (as should you) – and I started thinking about prior and active projects, and how I’ve been using shortcodes. Within the wide variety of use-cases – surely there was something in that array of projects that necessitated the use of shortcodes in a theme.
I found that, in almost every case, I kept shortcodes in a plugin. I prefer, through learning best-practice from developers more experienced than I, isolating specific bits of functionality from themes whenever possible, especially when working with a bloaty marketplace theme.
A responsible, modular, future-proof structure.
However – in a note by Brian Krogsgard on the awesome new PostStat.us, Brian said “…I think Leland’s broad brush statement is a bit dangerous” – and it got me thinking in the opposing direction: Is there a valid use-case for using theme shortcodes?
Yep, absolutely. Informed usage. The user of the theme just needs to know. That’s really all that needs to be done. “Hey, look, before you install this theme, know that every time you use a shortcode that’s bundled with it, you’re creating future development work, should you choose to ever switch themes. This is something you’ll have to pay a developer to do.”
Here’s something I’d like to see when a customer buys a theme that contains many shortcodes:
There are also countless use-cases when looking at WordPress as an extensible CMS or application framework; projects may be so highly customized that the typical structure of a theme, as well as whether or not shortcodes are a part of that theme are entirely irrelevant.
Many times, in cases such as those, the theme is the site.
I’m of the belief that it comes down to marketplace development standards vs. custom development environments.
A Race To The Bottom
If you’re selling a theme over and over in a marketplace, I get it. It’s a race to the bottom. The uninformed theme-buyer sees two similar themes: one has 21,000 included shortcodes, and another has 25,000 included shortcodes.
Which do they buy? They buy the biggest, bloatiest thing available – because all they see is that it looks nice, and has more options.
In a sense, they’re getting duped.
So authors keep bundling more and more crap into their themes. Theme developers keep one-upping each other with ‘features’ to ridiculous proportions. And why not? You’re not compromising the customers’ server, encrypting your code, or anything else considered over-the-top evil. The client is happy. The marketplace is happy.
So what if the large majority of WordPress developers detest working with your themes?
It’s a question, then, of ethics, and coding standards. Again, why do you care? You’re not obligated to do anything beyond meeting the marketplace requirements. And you’re not committing a crime, to be sure.
I’m getting snarky. My bad. Here’s why:
There’s a catch. That model will bottom out.
Sure, you might’ve purchased your first house (or second house) with bloaty-theme blood money, but one day, things will change. You’ll alienate more and more colleagues. Customers that want to change their theme will ask for support. Some will be less than polite to you or your support staff.
Folks will squint their eyes at you in anger at WordCamps. You’ll start seeing comments in your themes that’ve been modified by others, like:
// Alright, the stuff below I've commented out and pushed to a plugin with an exists check to the theme, due to poor coding standards in (your_theme_name_here).
A New Hope
A month or two ago, I made a small site called WP Bloat (site link) (related article on this blog) (related article on WP Daily). Notice a familiar name on the showcase page? Japh, WP Evangelist at Envato.
If you’re a developer of one of these nightmarish, million-dollar themes, c’mon. Be a sport. Take some of that blood-money, and maybe even outsource the theme-clean-up! You can do it. Leave a legacy you’ll be proud of.
I’ll close with a snapshot of what the shortcode tab looks like in the bundle of themes I’m currently working on:*
*They’re all GPL; no marketplace hanky-panky for me 🙂
Disclaimer: It was a particularly long day of cleaning up shortcode madness. Forgive my candor. Also: this little alert box is a shortcode, but it's a plugin. An admittedly dumb, tiny plugin - but at least it'll keep on ticking when I re-design this site. If you'd like the plugin, you can grab it <a href='https://github.com/ramiabraham/the-more-you-know-info-box'>here</a>, but it's little more than wp_register_style and some some images. OR IS IT THE GREATEST PLUGIN EVER?