Why Shortcodes in WordPress themes suck

20 July 2011 comment icon2 | Categories: opinion

I’ve just spent the last couple of hours troubleshooting a WordPress problem for a client who uses a commercial WordPress theme. They are a recent new client who worked with a previous designer who selected the theme for them. I’m in the process of building their new site and said I’d help them out with any issues they have with their current site while I get the new one rocking and rolling.

So it was with little trepidation that I dived into a problem the client was having with their homepage layout today. 2 hours later and I hate WordPress shortcodes. Don’t get me wrong, when used right WordPress shortcodes are a joy to behold. Contact Form 7 is an immediate case in point of where shortcodes work brilliantly. Need to add a contact form to a WordPress page? No problem, install Contact Form 7, setup your form and bang – drop the appropriate shortcode on your desired page – job done. For me this is what shortcodes were intended for – little simple hooks to link simple content items with plugin elements – bravo WordPress!

My new found hate for shortcodes is really a disdain for developers who abuse our little shortcode friends – it’s not the shortcodes fault you see – it’s how they’re now being thrown around like confetti for things they were never intended. Case in point – it would now appear that many commercial theme developers have completely lost the run of themselves and have start using shortcodes as the sole basis for laying out elements of WordPress themes like Homepages, Landing pages and so on.

This is wrong – plain and simple.

It’s a developer centric solution to a developers problem. In fact, I think it betrays the ease of use of WordPress and may give end users the impression that WordPress is way too complicated for them. While WordPress still has some way to go to improve usability of critical site management features like specific widgets on specific pages (Widget Logic is great but doesn’t work for your average WordPress user), it still does a pretty good job at delivering the goods right now for simple moving key content blocks around a webpage – if the theme developer has done their job right. I’m seeing a trend where shortcodes are becoming substitutes for widgets and page templates. Why does this drive me nuts? Well it simply means the end user now needs to go and learn a whole new form factor every time they want to setup a new website. The issue becomes exponentially worse when you consider that there is no overarching standards or guidelines for how shortcodes should be used for this purpose – meaning that every developer has their own way of implementing shortcodes for layout. While WordPress affords us wonderful levels of flexibility and many ways to skin the layout implementation cat – I would argue at this point that this is now hindering the theme development community rather than moving it forward.

Why do developers use shortcodes for layout purposes in the first place? My guess is it’s much easier and quicker for the developer than building custom widgets to control homepage layout elements. Wrong solution folks. Let’s work on making a much richer and intuitive mechanism for creating easy to use, reusable content widgets for things like Homepages, Landing Pages etc. I know that StudioPress have spent a lot of time adding nice little content widgets which do exactly this kind of thing. And are Page Templates all that difficult to create? Not in my experience! Plus I think users get that different pages have different templates intuitively. Throw in the flexibility of custom post types and custom fields/metaboxes and I see no reason why we need to continue down the road of Shortcode hell.

Leave those little gems doing what they do best and stop making me hate them.

2 Responses to “Why Shortcodes in WordPress themes suck”

  1. Alex on 28 July 2011 at 11:42 am said: Permalink

    Very good post, I can second that. We also don’t use shortcodes in our WordPress framework Xtreme One at http://xtreme-one.com , instead we are having powerful layout widgets with great functionality to create your website easily. We have 12 custom widgets to give the user the flexibility they need. You might want to check it out.

Leave a Reply