At some point in the past year, a disturbing movement has been growing in the WordPress theme development community. If you’ve ever looked at a few themes from Theme Forest, you might have noticed this horrible trend. This isn’t just a Theme Forest issue though; it’s a problem that’s growing in the theme development community and must be eradicated.
Theme developers, please stop bundling shortcodes in your themes that replace basic HTML.
I seriously doubt the Shortcode API in WordPress was built to do things like this. I also propose that using shortcodes in this manner is hurting the theme development community, hindering users’ ability to learn, and creating long term issues that cannot be easily fixed.
An example shortcode
To provide a model in which to present my argument, I’ve created an example shortcode called [note]. There are many shortcodes like it, but I’ll use this as the basis of this discussion. Its purpose is to highlight some text to make it stand out from a post’s normal content.
To use this shortcode, I created some example text in my development install and wrapped it with opening [note] and closing [/note] shortcode tags. In the post editor, it looks like the following:
[note]Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye. Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye.[/note]
That looks eerily similar to something something else many other people use around the Web: HTML. I’ll get to that shortly though.
The following screenshot is what the content looks like when the post is viewed on the front end:

This seems like a brilliant idea. Users wrap some text in a simple-to-use shortcode called [note] and magic happens! They have a cool new design for their text. What could possibly be wrong with that?
Problem #1: The “lock in” effect
Users, here’s what theme developers are not telling you: By using their theme’s shortcodes, they are essentially locking you into using their themes forever.
Let’s take a look at what happens when I switch to another theme that doesn’t have the [note] shortcode. The following screenshot is what the text will look like on the front end of the site.

As you can see, the pretty design for the text is gone and ugly shortcodes are left within the post content. It’s simple enough to delete those shortcodes in a handful of posts, but it’s a huge problem when users have 100s of posts that use this shortcode.
Users either have to figure out a solution to this problem or stick with using the theme. Niether of those options are user friendly.
Problem #2: Replacing basic HTML
HTML and CSS are not hard to learn, especially for something as basic as this. Rather than defining shortcodes, theme developers should define CSS classes for users to use within their posts. There are several benefits to doing this:
- No “lock in” effect as described earlier.
- Provide a way for users to learn some of the basic tools of the Web.
- Allow various elements to use a class, making for more semantic markup.
- No PHP required to create useless shortcodes.
Instead of the [note] shortcode, create a .note class and drop some simple CSS in your theme’s style.css file. The following is all the code it takes to create a “note” box:
.note {
padding: 25px;
font: normal normal bold 13px/25px Arial, Verdana, sans-serif;
color: #0a5e7a;
border-top: 1px solid #5ea6bd;
border-bottom: 1px solid #5ea6bd;
}
Here’s the great thing: you can use this with any HTML element your heart desires (e.g., paragraphs, lists, headers). The following is just a few example uses of the .note class within the post editor.
<p class="note">This is an example paragraph.</p>
<h2 class="note">This is an example header</h2>
<div class="note">This is an example box you can add several elements within.</div>
I have to believe that anyone smart enough to use WordPress has the capacity to learn how to use the class attribute within an HTML element. It’s possible that I’m wrong, but I have a lot of faith in my fellow WordPress users.
The counter-argument
The only possible argument I can think that theme developers can give is that it’s easier for users to figure out shortcodes than basic HTML. It’s a stretch, but I’ll allow the argument.
Let’s suppose [note] is easier to use than <p class="note">. Maybe there’s something inherently easier about using a [ and ] than < and >. Maybe the latter scares some folks off.
Assuming this argument has any validity, there’s still the problem of the “lock in” effect. The easiest solution to this problem is to create a plugin so that users can carry their shortcodes with them from theme to theme.
If you create a theme with custom shortcodes, do your users a favor and create a plugin that allows them to use their shortcodes even when they switch themes. Or, better yet, someone please create a massive plugin with all the known HTML-replacement shortcodes and end this madness.
Seeing an end to the problem
I previously wrote about this issue in the WPCandy’s 2011 theme predictions article. My fear is that this discussion will fall on many deaf ears and the trend will continue.
So, I have a promise to make. I will personally write the required CSS and fix this shortcode problem for any user that signs up for a support membership at Theme Hybrid. I will never lock you into using only my themes and will provide a way around problems like this. I encourage other theme developers to take similar steps.
Nice promise justin. I think the real problem is dat shortcodes in general are just a step to far. Maybe a customizable set of buttons which can be added to TinyMCE for instance, that would solve a lot more of the users problem and it will be a bit more user friendly.
That could definitely be a possibility for theme authors. I believe there’s a few hooks there to allow for something like that.
“”As you can see, the pretty design for the text is gone and ugly shortcodes are left within the post content. It’s simple enough to delete those shortcodes in a handful of posts, but it’s a huge problem when users have 100s of posts that use this shortcode.”"
This is the first time I’ve seen someone actually point this out. Thanks for doing this. A lot of people think that shortcodes are really cool,lightweight and easy to use. But you have hit the nail on the head by describing what happens when someone deactivates the plugin.
Personally I’m surprised that Wordpress does not automatically clean out the [shortcode] on deactivation . It would definitely augment the use of shortcodes in plugins and themes, if they even provided us with a simple function or method for this purpose.
Thanks again.
Bhargav R.
Thanks for this. I agree that it may fall on deaf ears simply because “lock-in” seems like a great goal for theme sellers. I’m not sure how successful your model is-commoditize the theme, sell the support-but I prefer it as a site developer / theme consumer.
I guess that the litmus test for a theme-developer’s “real” commitment to their customers should include this pledge of yours. Providing a plugin would be completely acceptable as far as I’m concerned.
I’m envisioning an organization / site (complete with logos and validation) for Customer-Centric Wordpress Developers – theme, plugin, site, service, whatever… complete with a code of conduct. Think BBB.
See, providing the plugin also allows you to keep that user in some way, even if they change themes. I believe it shows a real commitment to the users’ needs and provides an easy way for them to remember your services.
Also: can’t you just add classes to the TinyMCE drop-down menu or is that locked in?
I haven’t looked into it too much, but as far as I know, devs can hook into it to add custom buttons and such.
Adding it to the styles dropdown is really easy:
More details can be found in my answer on the WP Stack Exchange question “Can I add a custom format to the format option in the text panel?”.
That’s AWESOME. I’m so doing this!
Thank you Jan!
I love this, no java code to worry about and so much easier to implement than shortcodes.
I’m adding them into my plugin and ditching the shortcodes I’ve been working on adding.
Very cool. Learning to love TinyMCE.
I tend to agree, for the most part. However, it’s really useful when the HTML is more complex than simply adding a class to an element.
Complex HTML is a little different. For example, the
[gallery]shortcode is complex HTML. But, when things start getting that complicated, I always ask myself, “Would this be better as a plugin or within a theme?”Nice thoughts, I complete agree with you though but you have to remember that the client is a lazy. They don’t want learn anything new, they want it now an quickly
I often create some custom shortcodes for my clients, not because I want it, but because the clients requires. To avoid the “lock-in” I ussually place the shortcodes inside a new file, so if the client decided to move to another theme, he can moves the shortcodes to the new theme.
Clients are a different story altogether as they probably won’t be changing themes on a whim. I’m mostly referring to publicly-released themes. But, they still have to learn something new: shortcodes. I figure it’s just as easy to teach a little basic HTML and save some future headaches.
It’s nice of you to put the shortcodes in another file though. A must-use plugin is ideal for this.
Shortcodes them selves are hard to use for regular user. They dont understand how they work and forgot what does what and etc. Easier is to make plugin that would make button to editor and let people choose what kind of text they like to insert. A text style and text it self. Plugin then should make the right code with or without shortcode. Isn’t that the real problem?
Yeah, that’s a big part of it. It’s better for everyone to just build a plugin such as that.
Bravo, Justin! I’m so glad you wrote this article. I’ve been thinking a lot about this lately… partially because of the vendor lock-in issue, but mostly because of a different issue: mobile plugins.
We added a slideshow to our premium theme that works by replacing a shortcode with a slideshow of attached images. Simple enough, and it even works on mobile browsers.
Unless, of course, the blog displays a different theme to mobile users. Then any and all theme-specific shortcodes are broken. Fortunately we only have the slideshow one, but I’ve seen plenty of examples of other shortcode-heavy blogs whose content is near unreadable on a mobile browser.
We’re leaning towards the plugin solution here, but it’s not ideal… no one really wants to activate a theme and a plugin. Hopefully the discussion continues and a good solution comes to light. Thanks again Justin!
You can add them to both the theme and plugin. You can just run a
functions_exists()check within the theme to see whether you need to load yourshortcodes.phpfile, for example. I think it would solve both the problems for you. Plus, you could encourage users to activate the plugin for better features and quicker bug updates.But, I don’t really think users have a big problem activating a plugin for cool features, especially if the user benefits of having the features separate are clearly explained.
I don’t get it. Why don’t they just make a button (like Roy and Kristjan have said) or use a custom metabox to write actual HTML? A lot more user-friendly, so it solves both problems. With a bit of styling on the WYSIWYG editor and the user could actually see the blue-box note section.
I agree. The styling could come from the
editor-style.cssfile that’s now supported in WordPress themes.I’m one of those new-learning-users, and I thought this was a great post – both because I agreed with your points, and because I learned how to do something new with CSS by reading it!
I nearly looked through every theme I could find that has these shortcodes and posted the equivalent CSS. Then, I figured it would just take too much time. I’m glad you could make use of the code though.
I think the shortcode epidemic, especially on Theme Forest is a result of authors needing to pack as many “features” into a theme as possible in order to get the highest price possible. When developers can’t set their own prices and the main determining factor in pricing is what “features” it has then this is the result.
Adding classes is a far better solution, but I believe this problem is destined to get much worse in the near future.
Yes, that’s definitely a huge contributing factor. I kind of miss the good ol’ days when themes were simply meant to structure and style a site’s content and everything else was left up to plugins.
When I first started doing WP dev, I actually created a personal plugin to make the shortcodes [div] and [span] because for the life of me I couldn’t figure out how to get around the tab-switch (javascript autop) function. :-/ (Terrible, I know. I don’t do that anymore.)
Putting html in the post editor is still plagued by the wpautop switch tab short-comings, wherein various code will be either stripped, or garbled. There’s 100 tickets in Trac to get these straightened out, and some progress has been made, but it’s still an aggravating issue if you or your client switch back n forth to the visual editor.
I mention this to suggests that at least some of those shortcodes are an attempted answer to an often overlooked problem. (Not that shortcodes are immune from formatting issues when switching tabs…)
Although adding classes to TinyMCE is a much better idea, shortcodes are much easier to implement for those devs just starting out on theming, and messing with TinyMCE might not occur to them til much later.
These are all valid points. I just think devs need to start thinking about what problems their solutions pose and weighing the advantages against the disadvantages. Shortcodes-for-basic-HTML just creates new problems.
The cynic in me might say that these types of shortcodes are added by theme developers for the very reason you point out: it locks the user into using themes by that developer (often such shortcodes are shared across all themes by that developer). This is of particular benefit to those selling premium themes and other premium services.
You may have just unwittingly reminded the premium theme developers among your readers of a great way to add lock-in to their themes. Uh-oh!
On a slightly different note, there is one important difference between using shortcodes and using HTML. Shortcodes can be entered in Visual mode as well as HTML mode. Try explaining to a less-confident user how to enter some HTML markup into their post, but they can’t do it in the Visual tab as it won’t work, and that they’ll need to switch to the HTML tab and hunt through the markup to find the point they were at, and add the markup and then switch back to the Visual tab. This is the reason why shortcodes for blocks of basic markup are being added to themes.
I’m guilty of adding shortcodes like this when building bespoke themes for clients. When you’re dealing with companies who have marketers writing blog posts, there aren’t many options. (I’ll often add WYSIWYG buttons too, but all they do is insert the required shortcode.) In this situation it’s less of a problem because the client isn’t going to turn around one day and install an off-the-shelf theme.
We still have the data portability problem though, but I have an idea. I think it’s time for WordPress to recognise that there are users who don’t want to wade through markup just to add simple things to their post like highlighted paragraphs, so maybe rather than discouraging these shortcodes we should look at adding a standard set of shortcodes that represent certain features. We could start by looking at the most-used shortcodes across popular themes (if they are as prevalent as you say they are).
WordPress already has the [gallery] shortcode for image galleries and the [caption] shortcode for image captions. These shortcodes work no matter what theme is active because WordPress outputs the markup if the theme or a plugin hasn’t overridden it. There’s a slight difference with these shortcodes in that they actually get replaced in the Visual editor with a nice visual element. Whether or not similar behaviour would be appropriate for all the standard shortcodes, I don’t know.
For things like highlighted paragraphs, WordPress would output paragraphs with a particular class attribute by default (adding CSS support to the default theme of course) and themes could override the markup with filters, or just add support via CSS (I’d bet the majority of existing themes include CSS rules for the markup output by the [caption] shortcode). If a theme doesn’t support highlighted paragraphs, no problem – you just get a plain paragraph.
The actual markup that themes use for each shortcode is of course down to the theme if they choose to override it. A highlighted block of text in one theme can use different markup and CSS to another theme, but content containing the shortcode would be portable between them.
There are of course endless features that could be supported. I don’t really know how we’d go about deciding which to support. I do know that we now have post formats though, and WordPress is working toward standard support for those, so maybe it is doable with a small, core set of standard shortcodes for certain features.
Thoughts?
I could certainly live with a standard set of shortcodes. I’m not sure if I like the idea of them in core, but an article in the Codex might be a good place to start.
The best testbed though is creating a plugin to see how they’re being used.
In a lot of cases the “lock-in” is collateral damage rather than the actual intention. If coded smartly the shortcodes added by one theme can be easily ported over to another theme, simply by copying over the shortcode file and including the same in the new theme’s core files, and I am all for such a design.
Of course, the reality is different, and developers tend to invoke functions from other files in the shortcode file, which wrecks the portability.
I suspect the “lock in” is unintended by most developers. I further suspect that most devs using these shortcodes are copying and pasting them from other themes because it’s another “feature” they can throw in to wow users.
I’d like to avoid having users copy shortcode PHP theme to theme, but if coded correctly, it’s at least a temporary solution.
Hi, found this one year later, but having these problems right now.
I am using a wootheme and i am thinking to move to another theme, i found that i will have too much to fix on my posts because of the shortcodes.
Can anyone point me to a link where i can learn how to copy the shortcode from woothemes (or any shortocde) so i can use it on the new theme i want to use?
Or do you reccommend to update the posts to CSS instead of shortcodes?
Thanks!
Hi guys, sorry for the plug, but since its on topic just wanted to let you know I released a premium plugin that helps creating TinyMCE buttons and shortcodes from inside the WordPress Interface. This is not another pack of 100 shortcodes with predefined styles, it’s a simple WordPress interface to create that extra functionality you need for each project. Hope you find it interesting.
Sorry, I had to remove the links to your plugin. I think it looks like an awesome plugin and would be just the type of thing I’d like to promote along with this post. However, the licensing terms provided on the plugin’s page are incompatible with the GPL, which is the license WordPress is under. This is something I’m not interested in promoting on my site. If you do ever release it under a GPL-compatible license, please do link to the plugin here.
Totally understandable, I almost took them off from the marketplace but I been confirmed that all plugins on this site are licensed under a GPL license, definitely wouldn’t want to sell something against WordPress license.
Kind Regards!
Regarding portability, some MySQL find and replace action could work to change out simple shortcodes like [site-link] but that could also lead to more madness.
Yeah, I’ve done that a few times for some clients.
The find and replace plugin does a good job of this, if you want to avoid the command line or phpmyadmin :
http://wordpress.org/extend/plugins/search-and-replace/
The nice thing about this plugin is that it will allow you to do a search first, and show you the results – so you don’t do something you’ll regret
I agree with your comments Justin 100%. I would also like to add custom post types to this list as well. The same theme-shops are inundated with themes that are coded with custom post types which basically “lock-in” users the same way that the shortcodes are.
The sad part about all of this is that most of the themes sold on these sites appear to be aimed at other developers. It really seems as though most of the theme authors follow the trends of other themes being released. So when you see one become successful, you can bet that a hundred more with the same features (and code) are coming.
This is already spilling over into the free theme market, as well. Would love to see a quality theme be released and include plugins to control anything that is an “extension” of what a theme really should do.
Yep, custom post types should definitely be on the list. I’ve had this same conversation about three times in the past week.
Yeah, it just occurred to me that ‘premium’ themes that sell custom post types as a feature, really ought to be putting those custom post types in a plugin where possible.
If they switch to a theme that doesn’t support their “my-awesome-gallery” post type, the plugin should recognise that there’s no default template for it, and be able to display at least semi-properly it any theme’s default layout..
Unfortunately the bulk of theme developers seem to be very sheep like. They just follow the rest of the flock no matter who silly it may seem. Hopefully your blog post will get a few of them back on track.
Following wouldn’t be so bad if they weren’t following bad code. In an effort to be competitive and provide more “stuff”, theme developers are continuously increasing functionality and features that are well beyond the scope of a theme itself.
It’s perfectly fine to support these features within a theme, but the theme should be “extended” via a plugin and not have these features coded directly into them. It’s a help to theme developer in the long run too. They won’t have to roll out a new theme version every time a minor update is done to the plugin.
This is why Hybrid (as a framework) is such a good choice for theme developers (commercial or fee-based) as it allows the core to be upgraded outside of the theme, and any plugins that you may be using. So when it’s time to roll out a new theme, you simply figure out what features you want the theme to support, and add your HTML/CSS, which would substantially decrease development time and allow more focus on the design, and not the development, not mention make support much easier….(+1 for the plug Justin! haha!)
I hear what you say, but I think you have to remember your audience.
I believe Wordpress is so successful because it makes it easy for an idiot like me to create a website or a blog with a minimum of technical knowledge.
I’m not really interested in MySQL, PHP, HTML or CSS. I’m interested in content, so anything that can buffer me from all this stuff is great. I suspect that’s why shortcodes have become so popular – theme developers are responding to what the marketplace is telling them.
I accept the lock-in argument (been there), but I think shortcodes are here to stay because they do make life simpler for the end-user. Indeed, I’ve recently purchased a new theme with a shortcode generator, which is truly wonderful!
Seems we have a difference in perspective here – the purists who want clean code, and the end-user who just wants to write?
We’re not talking about all shortcodes. The discussion is based purely on things that should be done with beginner-level HTML. I personally love shortcodes and what the WordPress shortcode API can do. It’s one of my favorite features of WordPress.
In what way(s)? You never really say why it’s easier for end users. Furthermore, is it easier to learn a new shortcode or to learn how to use an HTML class?
This type of thing sounds great, except for the part about it being in a theme. It would make for an awesome plugin.
In my current project, I’ve used shortcodes for image effects, buttons and especially columns. I can rattle a page together very quickly, which is why I like them.
I accept that they de-skill the process, but that’s their purpose, no?
However, you do raise an interesting point about what should be included with a theme. Looking at something I did last year, it has one theme with 11 plugins. My current project has one theme with zero plugins, as the theme includes a lot of functionality. What’s best?
Since it’s not a public-release theme, it’s really up to you. I would still go with adding plugin functionality within a plugin though.
Many of the clients I work with are not willing to learn HTML when writting to their company websites. Only some of them would learn it.
In the other hand I absolutly agree with you about “your tied to the theme company”.
Great post.
Regards
Client work is a different story, but why not just add this stuff to a plugin rather than the theme for your clients?
Hi Justin,
Interesting post, it’s certainly provoked a debate
I work with a great deal of people across a variety of levels of understanding, from ‘I want a website’ to ‘Here’s a detailed spec and design’ and for the most part these people have never heard of HTML let alone know how to write it.
Additionally these types seem to not want to bother using or learning it either. Often Wordpress is a means to an end for developers who want to get a nice site up and running quickly and extensibly. I go through an entire training process with people who I have written sites for only for them to come back a few months later asking what their login is
The point of this of course is that there is definitely a sector of the market that doesn’t care whether they are locked into a theme or not because mostly the amount of customisation that goes into making a stock theme (or a theme framework such as yours), premium or otherwise, suit a corporate brand or desired layout.
I think that a shortcode or two built in to make the odd person who wants to highlight text’s life easier is nothing but a good thing. A Tiny MCE button is, of course, a nice alternative as with the editor style CSS file mods which people have been suggesting. The reality is still that all these changes, unless built into a companion plugin or parent theme (which still locks them in, but to a theme group as opposed to a theme individually, technically) still causes a certain amount of ‘locking in’. Page templates themselves are enough to stop any sensible site owner from changing theme. The simplest thing is to just modify the one you have
Good post though, hope the birthday went/goes well.
thanks
Sean
There’s always going to be some sort of locking in if a theme adds anything unique. The goal is to minimize that as much as possible, especially when it comes to things that should be handled by plugins. Many, many users change themes as often as I change underwear, so plugins cater to this user group much better.
I don’t have anything against the idea of putting these things in themes as long as the theme developer offers a solution for users when switching themes.
I couldn’t stop chuckling as I read your post Justin. Sort of like the argument why it’s important to learn the drive a manual. I learned to drive one and love it but before I did it was a complete mystery why someone would “waste” their time and shift gears with a stick.
A few months back Woothemes released a bundle of shortcodes and there was a comment backlash. Others are feeling the frustration of development resources being put into shortcode creation vs functional or design improvements.
One valuable thing I do get from shortcodes are the dynamic buttons because Photoshop is my mortal enemy.
Almost none of my clients learning WordPress have any experience in website design and those that do hail from the creative / Photoshop side which is often just as bad because they’ve picked up bad habits along the way without even realizing it. A few actually want to learn html/css but they’re far outnumbered.
My dad made me learn to drive stick once. I fought the idea for the longest time, but it did come in handy a few times throughout the years.
I do this with clients though. Some are a bit tougher than others, but I’ve never had anyone complain after learning.
Cracking post.
It’s a shame good programming getting sacrificed for ‘shiney’ theme features. Same story with how little the WP API gets used.
Worth noting that shortcodes can always be overwritten at theme level in function.php if the outputted html changes from one theme to another.
That is a good note to add. I remember accidentally stumbling upon the ability to override shortcodes at the theme level once.
I am definitely on the shortcode as a plugin side versus including the functionality as par of the Theme’s; especially since I published one a short while ago that does almost exactly what your [note] example suggests.
I had considered adding it to my Themes directly, but it made more sense to create the plugin to leverage common CSS elements found in almost every Theme instead. The premise being you can change the Theme but the essential look and feel of the text within the shortcode tags would remain relatively consistent.
Plus, it’s much simpler to add a few lines of CSS rather than having to deal with creating the PHP for the shortcode if your new theme doesn’t quite have the right design for the shortcode.
Nice write up. I was recently thinking about this shortcodes problem. It’s true that most of the premium themes add shortcodes for columns, information boxes, buttons, etc… even some of them add short codes for quotes–I don’t know whether they missed that shiny button available on both the visual and HTML editor.
I don’t know if you ever saw it or not, but there are other ways theme authors seem to lock users these days. I’ve come across several themes offering advanced SEO functionality such as rewriting titles and offering users a way to block search engines from indexing categories, etc… These options will get away once the users change their themes and suddenly, Google will give them a booting.
Someone should really tell these novice theme designers what belongs to a theme and what belongs to a plugin.
Thanks,
There are tons of ways to lock in a user. Sometimes, devs do this on purpose. Other times, devs unknowingly do it as they’re learning the ropes. I know I have a few features like this in my themes, but they’re mostly backwards-compatibility features for users that have been using my themes for years.
The trick is to just give those users an option if they ever change themes. This can be in the form of a plugin, a tutorial, or a quick code snippet to copy/paste.
What an incredibly interesting and thought provoking post. You’ve raised some points, with regards to commercially available themes and shortcodes, that I honestly never considered before. With a shortcode, whose sole intention is to return an HTML element with a specified class name, will not port if the user changes the theme. Multiply this over the amount of shortcodes that any given theme may have (I have seen some advertised as having 150+!) and you have a potential disaster on your hands when that user finds the next great theme. I am finding the same to be true, with
post_thumbnail();but that is a conversation for another time.In an effort to be 100% transparent, my company has recently started selling a theme on Theme Forest, which has been a rich source of mass market customer service experience. What I was not quite prepared for, which we discovered via feature requests by potential/existing customers, was the overwhelming call for more shortcodes than the 9 we provide in our theme (and yes, we are guilty of the “note” shortcode). We originally released the theme with 5 shortcodes but slowly added more based upon these requests.
Now, being that this was our first foray into designing and developing a product for mass consumption (99% of our work is client based) I was pretty amazed at this. I erroneously assumed that the majority of users, who I believed cared little to nothing about learning front end development, would care even less about implementing shortcodes. I was adamant, in our original strategy meetings, about not bloating the theme with useless “eye candy” effects. I would argue, “The customer will not care about a note shortcode.” Boy, have I been proven wrong. But, when faced with market demand I had to be somewhat flexible here as the decisions I make affect our revenue stream.
I am, by no means, a PHP programmer. I surround myself with greater minds, like yourself, to help me realize my insane schemes. When designing and developing projects for clients, we have a budget based on the scope of the project. This allows us to set aside dedicated hours of development strategies to execute the client’s requirements. The end result may include the deployment of a custom plugin without negatively impacting the profit margin.
This was not the case with our commercially available theme. Because we are unable to set our sell price I had to be extremely cautious with the amount of hours spent in development. The last thing I wanted was the phone call from our accountant about a low ROI. Shortcodes gave us “quick fix” solutions for features that are probably better handled in non theme dependent ways. This may read as an excuse, which is not the intent. But, I wonder if other providers are faced with the same predicament?
So, the leads me to the question of did commercial theme devs originally set the tone for this market craze for shortcodes? If so, then isn’t it our collective responsibility to course correct the market, so to speak? I don’t pretend to have an answer but, judging from the tone of your post and the preponderance of successful (based on sales) commercial themes loaded with shortcodes, I get the feeling I am being naive?
With all of this said, you definitely have me rethinking our strategy, with regards to shortcodes, for our next commercial theme release. Thanks again.
Erik,
You can certainly add this requested functionality into your themes. If we ignore the voice of the customer altogether, then we’d all cease to exist as companies or freelancers, as after all, this is all for them in the end.
A great to way to add customer enhancements, because many requests tend to be for things outside the scope of a theme itself, is with a plugin. You can create a custom plugin for just about anything within WordPress, and it allows you to keep themes and extended features separate which certainly helps development.
Some of the extended features that a plugin might be an alternative for would be shortcodes, of course, custom post types, portfolios, galleries, product showcases, shopping carts, etc., etc. The opportunities are endless. I have even gone as far as to create “custom” plugins for specific requests. It makes a client feel as though they’re being given special treatment (and they are, in a way) which is worth it’s weight in gold in this business. The best part is, plugins take no longer than coding a feature directly into a theme would take, and you can then use the plugin with any other theme you develop down the road….best of luck to you!
Agreed.
Also, just think about selling themes and selling a shortcode-generating plugin that your themes support. This offers more products, another “feature” for the themes, and costs next to nothing in development time.
So true. I also don’t find right to insert inline styles such . Users never mind. There are people aligning images, texts etc with inline css and html, is a bad habit and hard to vanish off. I think while people still misuse the WordPress text editor, shortcodes should be restricted.
I don’t really see this as an enormous problem, but maybe that’s because I mostly do client work for folks who will never want to change themes. But if you want a reason why using shortcodes is more popular than using HTML in posts, I would point directly to the TinyMCE editor. We’re used to it, so we forget how much it just plain sucks. Unlike HTML, shortcodes work, they don’t get stripped out, and you can put them in the Visual or the HTML tab.
Exactly. In the early days, the rationale behind not implementing easy template tags was that PHP was a transferable skill. Similarly, a superficial knowledge of basic HTML and CSS is much more useful in the long term than remembering a shortcode, because you can go on and use these things beyond a single blog. (I too refuse to believe that anyone capable of negotiating the dashboard in its current complex state can be too thick to add a style to an HTML tag.)
But you can’t realistically advocate abandoning shortcodes without also suggesting that people switch from TinyMCE to the basic editor. As it happens I don’t think that would be a bad idea, but I also know it’s never going to fly with the end users who just want everything to be as much like Microsoft Word as possible.
The things I pointed out in the post are most definitely enormous problems with publicly-released themes. I deal with at least three or four users a month that have the “lock in” problem.
If you do client work, this post isn’t really as relevant since we’re talking about themes released to the public. Nevertheless, why not just create a plugin for your clients instead of packaging this stuff in a theme?
Valid point Justin, and thanks for bringing it to our attention. I did like your suggestion regarding a packaged plugin to go with the theme.
I can understand using shortcodes in custom jobs for clients; a client will generally want a complete design, and the content styling will be coupled with it. But for public release themes, you’re right, keep the shortcodes out.
For public-release themes, shortcodes are evil.
As for client work, in my experience, I’ve always built solutions, not themes. So, why not just create a plugin for client work?
The problem is TinyMCE, but not with the editor itself, but the fact that it works in two modes.
Shortcodes work while you’re in Visual mode. You type in [blah] and you see the code in the editor and magic happens when you view the page.
To use HTML, they have to switch modes to HTML and then do everything in HTML which when you look at a whole post or page in HTML vs. doing everything in WYSIWYG mode, it would scare many many Wordpress users.
Still you are right in principle. Theme developers should not be re-writing HTML.
This would also depend who you are doing the theme for. Shortcodes are great. Probably not in theme that will be freely downloadable but most of my work is for a client who is paying me for the theme. They are not simply going to change the site with a free theme that wasn’t made for them. I agree with Rob above, short codes work in the visual editor. Telling the client to switch to html is whole new ball game.
Yeah, we’re mostly just talking about publicly-released themes here. I probably should’ve made that more clear in the post.
Nevertheless, why not just put these shortcodes within a plugin for your client? Wouldn’t that solve any potential problems both in the short and long term?
After reading everyone’s comments, I feel like I need to ride the short bus to shortcode school. Does anyone have a great resource to shortcode “school”? As a consumer, newbie and do-it-myselfer, I would appreciate shortcodes any way I can get them…theme, plugin, pay-per shortcode, etc. (Does anyone know of a pay-per-shortcode site?)
Is there any way to add shortcode to a plugin such as “Members” (which is awesome btw) so that other shortcodes can be used with it?
Here’s the Codex page on shortcodes:
http://codex.wordpress.org/Shortcode_API
Lots of plugins use shortcodes. Also, the built-in WordPress gallery system uses a [gallery] shortcode.
Just remember that a shortcode is a means to an end, not a good thing in and of itself. Figure out what you specifically want to do first.
What a timely discussion. As a website producer for small businesses it’s a topic that’s been on my radar screen a lot lately. Not so much from the theme “lock in” aspect, though I’m going to pay more attention to that now but really from my client’s point of view.
I’ve been keyed into shortcode features because it gives my non-tech clients an easy way to add formatting on their own. What may seem like a basic procedure to add a class to a div tag is just too much for many of my small business clients. They switch to the HTML tab and freeze like a “deer in the headlights”.
Putting in a shortcode on the VE side is easier and less daunting.
This week I had client that needed to create column layouts and found the J Shortcode plugin in the WP repository. (Wasn’t sure if I should link or not). It’s been working pretty well so far for them.
This topic really highlights the issue of keeping the easy parts of WP (publishing content) easy for non-technical end users while still being able to take advantage of what’s evolving with website design.
Thanks Justin
Feel free to link to the plugin. It sounds interesting.
I love shortcodes too. For me, I used to use a PHP plugin to allow PHP in my page editor. Now, I just write a shortcode any time I need something like that so I can keep my PHP separate from the content itself.
Shortcodes are all about making our lives easier in some way. As long as we’re making sure we’re not hurting the end user in the long run, they can be extremely useful tools.
Here’s the Jshortcodes plugin link:
http://www.jshortcodes.com/
The lock-in effect will still be there if you use CSS classes. When you change the theme you lose the styles.
A plugin for shortcodes is not ideal. First of all, most of these are theme-specific. Most of these shortcodes need styling and in some case some JavaScript code (like toggle and accordion shortcodes) so packing it as plugin results in loading all unnecessary CSS and JS files.
No, the lock-in effect described above won’t be there with classes. The user’s content will not be broken when they change themes. Losing styles is expected when changing themes. That’s kind of the point. Having your content break when you change themes is not expected.
A shortcode plugin would not load unnecessary CSS and JavaScript. This argument doesn’t make much sense. They’re no more unnecessary in a plugin than in a theme.
I see your point.
So what we should do is to create a standard library of shortcodes and ask theme designers to style & script these. Right?
I don’t get it.
Why do you say that **most** shortcodes are “theme-specific”?
I don’t see it that way in real life.
I meant from the design point of view. The design of [button] and even [accordion] are up to themes.
This was is a great discussion. As one of those hermit-ish folks that develop wildly complex theme frameworks in an enterprise environment (higher ed.). I absolutely love that themes have as much power as a plugin. It’s a good way to build in serious application features and control.
I’ve been happy to see the theme market grow over the years, but I’m even happier when folks call some of these developers out for some of the things they do. I’ve been shocked by some of the theme packages I’ve encountered for my occasional clients. It’s sad to charge someone time to clean up a site because of a product the client PAID for.
In my case I do more evil in some themes, but I would NEVER release that the public. If I did, I would at least give my users a way to clean up after myself. Hopefully WordPress will get those theme activation/deactivation hooks:
http://core.trac.wordpress.org/ticket/7795
http://core.trac.wordpress.org/ticket/14955
Yeah, I’m waiting on the activation/deactivation hooks too. That would at least provide a way for themes to clean up after themselves if the alter post content.
sadly i think you hit the nail on the head “scares some folk off” people see code-esk symbols and bam they really dont want to use them for fear of getting it wrong. [ and ] get used by your average joe bloggs user in almost every forum and they are familiar and that probably means that until the average user sees some of the outlines issues, the short-code is here to stay
No one is arguing that shortcodes shouldn’t be used or are not here to stay. This post is about the implementation of shortcodes within themes.
Love the post, Justin. Valid points all around. I’ll see about creating a tutorial for adding custom buttons to the editor.
However, the big concern I have is theme developers avoiding shortcodes in favor of bloating the TinyMCE with buttons. I suppose we’ll have to see where the trend goes from here.
I certainly think shortcode has it’s place but sometimes the added CSS and Java make them pointless as they add to much code which is counteractive to the goal.
As I mentioned, here is a tutorial for building a custom button for the TinyMCE editor in wordpress.
Custom TinyMCE Buttons
I have no doubts you can improve it, Justin, but I wrote it in answer to your post, here. I’d love to see someone add a jquery form for it. Either way, it is a minor solution to the shortcode issue arising.
The next problem I see is still that the TinyMCE editor will be flooded with custom buttons.
Awesome! Thanks for posting this as a tutorial.
No worries. As a fun note – your book finally arrived in my mail this afternoon (WordPress Plugin Development).
My cat thanks you for the box it came in.
I used this plugin on a client site : http://wordpress.org/extend/plugins/post-snippets/
it adds a button to tinyMCE, which allows the user to add shortcodes that you create.
That looks awesome for creating custom shortcodes.
I work exclusively with small business corporate CMS type websites. I have built lots of them with a custom theme for each (using my own developed theme framework).
Most of my clients will not contribute to their website if it is difficult. They’ll let it rot and become stale. My job is to make it as easy as possible for them. That’s why shortcodes are important, but it is not easy enough to have them remember the various ones available. I already give them too much to learn, and adding html to it, would be much too much. That’s why I use a plugin that works quite well. The plugin has a tinyMCE button, that presents the user with a dropdown menu of various options and it works quite well for them.
As it is a plugin, I don’t have the lock in problem. I want my clients to do business with me because they want to, not because they are locked in. I work hard to keep them coming back to me, and if I don’t deserve it, they should choose someone else, and I would support them.
Not all clients are the same, I work with ones that are just too busy or too inept to do much with their sites. Just my two cents worth.
You’ve got the right idea, which aligns perfectly with what the article is arguing. I’m glad you’re providing this feature for your clients through a plugin.
I did remove the link to the plugin you mentioned though. The license included on the plugin’s page is incompatible with the GPL, which is something I don’t promote on my site here.
Assuming your words of wisdom create a cascade of change in the WordPress community, Justin, I stumbled across something else to consider:
What to do when you move away from shortcodes (or the nonsense ones)? The code still exists! Time to systematically go through your thousands of posts and remove the code…
Or do you?
Try
from http://www.wprecipes.com/wordpress-tip-get-rid-of-unused-shortcodes
Hello Justin – I came across this post just a few days ago, so today (just now) when I received an email about the *** plugin from ***, I thought of you.
Is this the sort of idea you were talking about?
I don’t really know how to post the/a link that’s clickable, so I’ll just put it here and let you edit if needed:
p.s. It might not be wise for me to do (post) something like this because I know nothing of it or if it really works well, but it kind of sounded like this topic. If this sort of linking is not supposed to occur, you can gladly take this down. I have no affiliation, and am really a newbie to WordPress (only building my second site with it), but I’ve been trying to learn as much as I can from you guys. Thanks for the details in your posts!
The plugin definitely looks like something I’m talking about. Unfortunately, it’s license is incompatible with the GPL, which is the license WordPress uses. I removed the links and plugin name from your comment because this is something I won’t promote on my site.
Yeah – absolutely, that’s what I thought. That’s why I almost emailed you (main goal was just to tell you – which you probably knew about already). Sorry you had to type the same stuff over to me in the post about removing it.
Have a great day!
No problem. I read all comments left on this site and check out all links.
Hi Justrin! Thanks for the brilliant post. All those steps you mentioned are clear for a coder, but I am not. All I can is to create PSD based templates, but when it comes to Wordpress publishing, I get lost. I have no idea how to generate them to Wordpress. Do you know any automatic publishing tool? Thank you Justin and you guys…
I completely agree with your points, Justin! The main trouble comes when there is a need to switch the theme.
What if, there is a plugin which does so ? I think, it’s better to use and gives the users a freedom to switch theme. But, of course making it compulsory to use the plugin forever.
I did write a plugin for the above example you have mentioned http://goo.gl/iqVzT
Co-incidentally, this plugin was written only a few days before this post was published.
Awesome! That plugin looks cool.
This plugin (along with my other plugin) was removed from repository without any information.
Could you please guide me about how can I put it back ?
You’d have to get in touch with the folks at WordPress.org.
Hi Justin,
Came here after reading your tweet about “super premium themes”.
This shortcode madness does not affect only users of theme forest themes, it is actually affecting theme forest theme designers as well.
Just recently, I had helped a theme forest theme designer work on “backward compatibility” of some of his shortcodes. He wants to combine a few shortcodes into one to make it more efficient for his users, but does not want his users to go back and delete old shortcodes.
In order to solve this issue, I had to change the old shortcodes to “do_shortcode(‘[new_code]‘)”. These may seem more efficient for the users, but old shortcodes cannot be removed, when new shortcodes are added, this only adds on the weight of the theme, and in my opinion, not really efficient.
In the long term, these themes will get bloated to a point that installation fails due to large theme file size.
Back to the “super premium themes” issue.
Actually most of the theme forest themes are “stupid premium themes”,
they only have nice graphics but poor programming standards.
I actually had a few clients coming to me with theme forest themes, asking me to make it work with certain plugins, and all I have to do was to add wp_head hook to it!
And yes! I agree with you that those who call that super premium themes are morons!
Thanks.
Denzel
More than half of my client work is fixing problems with Theme Forest themes. It’s usually basic WordPress programming stuff too, so it’s easy to make a quick buck.
I’m a huge fan of Theme Forest. Maybe I should stop writing these posts telling them how to fix their themes.
Great Post,
It just make realize as a customer, that i have locked in with one theme all the times. And what do you think about theme’s custom setting panel that usually come with premium theme, e.g where you can upload your logo & favicon, Feature slider, number of post displayed on homepage, SEO stuff, etc. Do we have to set all of that again when we change theme ??
Thank you very much..
Regards,
Gerry
It depends on the specific settings and if they’re using the correct WordPress features for things like logos and backgrounds (most “premium” themes do not). In general, theme settings aren’t transferred over though because they’re specific to that theme’s design rather than having anything to do with your content. Granted, some themes go overboard and add settings for things they shouldn’t really be adding settings for, which might change content.
Just wanted to drop a quick thanks. This post inspired me to begin to go back through everything I have coded and make all additional functionality plugins. And what better way to make it a plugin then use your book to assist the process! It is a long-shot yet to make CPT/shortcodes compatible with various author themes, but plugins will be the way to start. Definitely something I have been mentally struggling with for awhile and this post set in stone the future couse of my work.
Jacob
I’m glad you’re reevaluating how you use shortcodes. It’s definitely a major step in the right direction.
I modified TinyMCE for a client’s corporate Website to do exactly that: Allow the marketing content writers to add styles to the content, using only the visual editor (don’t need to even know what HTML is). The select a paragraph, use the pull-down in TinyMCE for a right-hand pullquote and hop! There you see the results immediately in the editor.
I think the time spent to make shortcodes and external shortcode files would be better spent customizing TinyMCE.
1 – No lock-in
2 – See the results live in the visual editor.
Thing is, I can’t remember how I did that (almost 2 years ago). Can someone post here some explanations how to customize TinyMCE’s pull-down menus, or link to an article about it?
David J – I was just looking at how to do that today at http://www.sycha.com/wordpress-assign-custom-css-classes-visual-editor/
Although not mentioned in the original post by Justin, I think it is very important to note that shortcodes add a lot of weight to wordpress. Keep in mind that they are generally written in a plugin and/or the functions.php file.
With that in mind think about how much extra code is being loaded. Even with complimenting your shortcode and Just Tadlock’s point by not writing basic html as shortcode you might still have 20+ shortcode elements. That all gets loaded and increases the size of your files on every page that is loaded on your website – regardless of whether the shortcode is even used anywhere.
By using the TinyMCE editor to place your custom code via buttons and/or dropdowns and not using shortcodes to do it you are speeding up the load of your front-end website substantially. The TinyMCE is only loaded within the administration, thus, any code written for that will only be loaded in the back-end.
You can see my tutorial about adding custom tinyMCE buttons if you like. (already linked in another of my comments way up the chain..)
The bottom line to my point, with emphasis on Justin’s, is that shortcodes shouldn’t be used unless absolutely neccessary. Realistically, they simply aren’t neccessary when there is a more efficient method.
Neil, I was just having this discussion with my developer friend today (I’m a designer).
I get excited by all the designery things I could do with shortcodes, and he gets all agitated about how much it will bloat everything up and slow it all down.
So, it seems pretty obvious that the best solution for simple things, like adding a class to an element like a paragraph or blockquote, would be a TinyMCE button that directly adds the HTML, rather than a shortcode. But I only know how to add it to the drop-down Styles menu – is it possible to create a button instead?
The other great benefit is being able to see it happen ‘live’ in the visual editor if you use the editor.css, as someone already mentioned. Much better than using a shortcode!
I’d love a plugin that let me generate TinyMCE buttons that add classes. It would be super-awesome if I could create a button that brings up a dialogue box that lets me insert text, like one field for a testimonial and a second one for the author, and a third for the company name (all styled differently). I know you can bring up dialog boxes for shortcodes – is it possible to bypass shortcodes altogether?
I don’t want to hijack Justin’s blog, here. View my tutorial on building a custom tinyMCE button and that should answer your question well enough. I also responded to you there.
Sorry Justin!
Feel free to hijack the comments here. You’ve provided some great stuff for theme developers to work with. That’s just less work for me.
Hello Justin! I just wanted to find our the way you guys publish psd to wordpress? Any ideas fro me to follow gladly?
Well, I would have thought a main argument is cross browser compatibility. I would be using shortcodes mainly for this: With the hell of cross compatibility I would rather trust a good developer to have done his/her background research and testing so that i can just safely use their shortcode.
If cross browser compatibility issues would not exist then ok I would go for a class and some css but they do exist and the code for a simple box is likely to be bigger than you used taking into account all the fixes….shame…
taka care
Cross-browser compatibility is irrelevant in this discussion.
To carl shreder: try Divine Elemente plugin http://elemente.divine-project. com/ designed for PS. It converts PSD to WP automatically and works really great. Although, there are some minor things better to be improved, but if you are not professional coder, this might be useful..
@ema
Thannks for the divine plugin. I started to use… For now all works correct. On which way you think to improve it?
I see your point, but for those of us that aren’t savvy coders, shortcodes really do help with getting stuff to “look right” without plowing through lines and lines of code.
I love shortcodes and use them all the time. The usefulness of shortcodes is not really the discussion at hand though.
I agree with everything you laid down here. I think everyone should be able to learn basic html and css, and I hate that when i use shortcodes I become reliant on the theme or plugin I’m using.
However, I manage a good number of writers that don’t know anything about html and css, and coding things does scare them away. I decided to start using a shortcode plugin and it has improved things remarkably. I use this plugin (***) It allows my users to incorporate things in their writing that they wouldn’t be able to do in a million years, even if they did know css and html. Right now it’s fantastic, but I’m sure in 3 years i’ll hate myself for using it.
I had to remove the link to the plugin. The license on the page you linked to is incompatible with the GPL license, which is the license WordPress is under.
Using a plugin for this type of thing is great though. Using something like that is perfect when you have a lot of writers that don’t know anything about code.
I don’t see any difference between being “locked-in” to a theme and “locked-in” to a shortcode plugin like the ones mentioned above. At some level unless you develop your own custom shortcode plugin for clients, you’re going to be locked in to someone else code. And if you create your own plugin, you’ve locked yourself in to maintaining it.
When a client switches themes, my experience has always been a lot of recoding is necessary anyway, so just add shortcodes to the list of chargeable time.
Clients are a different beast altogether. We’re mainly referring to public-release themes here.
There’s a major difference between being locked into a theme and locked into a plugin though. When you’re locked into a theme, you can never switch themes. Unless you’re comfortable enough with PHP to transfer the shortcodes, you’re stuck with the same design. Most WordPress users aren’t that tech-savvy.
Content should always be separated from design. A theme’s purpose is to handle the design of a site.
Thanks for the write-up. Got me thinking and working. I’m currently writing a plugin that contains some standard ‘shortcodes’ and left to the theme designer to use them at will, allowing multiple themes to work against the set.
Thanks, really it’s a very great post I loved it very much and I loved this website so I bookmarked it.
you say to create a style, but even creating a style, when you change theme, you no longer will have that style!
That’s kind of the point of changing themes. Please read the article in its entirety and comment upon that.
Frank above is right. The “problems” you pointed here are inherently WordPress issues.
There’s no major difference between being locked into a theme or a plugin. If you’re using a plugin’s shortcode to display polls and a theme’s shortcode to display “notes”, you’ll get the same behaviour after you uninstall / change them, so you’re locked into plugins the same way you are into themes
No, you’re absolutely not locked into a plugin and theme in the same way unless you believe plugins and themes are the same things. The problems are also not WordPress issues. They are quite simply issues that theme developers (especially many at Theme Forest) are causing for their users.
So you’re saying that people change themes more often than plugins, ..or?
I agree though that using shortcodes for “notes”, and in general building HTML layouts with them is pretty stupid. If a theme developer wants this functionality he should probably make it destructive with a custom TinyMCE plugin or something like that. And the same applies for a plugin..
I said nothing of the sort. Go back and read my comment again.
THANK GOODNESS!!!
I thought I was the only one who saw this serious problem.
I’ve been spending the last 2 weeks researching Themes and downloading a couple and messing with them, and I too saw the SAME exact problems with Shortcodes.
I was simply amazed that they were being used. However, you guys took it even further than I had thought about yet. Me, I was just looking at the problem of Shortcodes being on the “Visual” side, WITH the text, rather than in the HTML. Thus, those us who make posts with a good amount of text, shortcodes would mess it all up.
I had thought that they could just stick it in the HTML just like TinyMCE already does, such as with the “Blockquote” shortcode in their menu. I simply couldn’t understand why all these theme developers are putting the code in the Text itself, it has floored me. But, you all take it even further in relation to coding standards themselves. Cudo’s…. Definately a big problem. If even I recognized it and I’m a NEWBIE with using Wordpress.
Tisk tisk…..
This article has been really helpful. I am en end-user but also in charge of a very large site (an amateur webmaster). I am about to switch to wordpress and could have ended up with one of these themes that uses shortcodes, so thank you for saving me from that.
My question is – we will need to rely heavily on a few of these note-like styles in our articles. What would be the best way to style them so that even if we are forced to change our theme or plugins later, the box styles would be easy to update or maintain? I hate having to rely on someone to update a theme or plugin. So many of them go defunct at some point.
Thanks.
Justin…awesome article! To be honest, it makes a lot of sense, so much that I will implement this with my next theme I am creating. You bring up good points, and you are absolutely right that if people get too comfortable with shortcodes, they won’t learn basic html, or at least, they will start to lose the knowledge…almost like myself where as a little kid, I spoke french, but after many years of not speaking it into my adulthood, I’ve lost most of it. Also, the part about changing themes when they have shortcodes in their content is also something I never even thought about.
So as of today, I will only use shortcodes for the more complex structures, or at least provide the user the choice between html or shortcode.
I’m in complete agreement.
Some shortcodes make sense. I insert gravity forms with a shortcode, it makes life easier.
But, a popular theme that I use has a [blockquote] shortcode. I find that appalling.
Justin, anyone taken you up on that offer yet? That sounds like something I would do… I once offered to reformat all of my professor’s Word documents that were written in Times New Roman with bold, underline, and italics used all together. I bet you can imagine how my eyes bled every time I glanced at the syllabus – http://whoaitsaimz.blogspot.com/2010/01/my-last-semester-with-timesnewroman.html
Anyway, the other problem I see is that not only does it look cluttered in the editor when it’s full of shortcodes, but the end result (in either “preview” or when published) looks COMPLETELY different from what the user first sees. At least with some CSS for the admin styles, theme authors could give users a real WYSIWYG experience as I imagine the TinyMCE editor / Visual Editor intended to do. Not some jumbled up mess of brackets.
Thanks for initiating this timely discussion.
You know, as a relatively naive user, I would never guess how complicated it could be if I used a theme that used short codes! This is why I’m so intimidated to make the switch to Wordpress – there are so many variables out there that can cause my blog to go haywire. Thank you for this, at least I now know what could happen!
One problem with your argument is that you assume everyone wants to or should have to learn HTML. When I make a website for a research lab, their job is to continue doing cancer research, mine is to make sure they can manipulate their contact/donations form while having to spend as little time away from their job as possible. Frankly…this assertion is a little narcissistic. You have your job…part of it is HTML. Other people have their jobs…some maybe not as important and maybe some more important…but very few of their jobs’ is to learn yours.
A second problem is that you seem to not understand just how much complexity shortcodes relieve from the user. The difference is not between using similar code just with [ and ] instead of as you suggest. The difference is as enormous as creating an entire jQuery tabbing interface that requires 50+ lines of HTML as simple as a single shortcode called “tab_group” filled with 3 or 4 shortcodes called “tab”. Or using complex color algorithms that automatically determine gradients, border colors, and rollover colors based on 1 single color attribute in the shortcode…which would require the user manually filling in each with proper color harmonies to do the same in HTML. If it was truly just for simple tasks like links and images then there is no need for shortcodes, authors would rather just let tinyMCE handle it, that would be easier/better for author and seller. But that’s not always the case.
When it comes to “lock-in” your point seems a little misleading. One could argue that your approach of using HTML with a particular class is no less prone to it. You say to use a certain tag with a certain class instead of a shortcode. If you change themes it’s still just as likely that the new theme won’t have the proper class definition (or that that definition wasn’t written to be used the same was as in the old them) just as much as it won’t have the proper shortcode definition.
Lastly, you seem to be taking certain things out of context to make your point. Sure, having a “blockquote” shortcode seems stupid. But now put it in context where a theme has 40 other necessary shortcodes that would not be easily used as HTML and tell your client that they can use shortcodes for the more complex stuff that needs it…but you’re going to require them to learn a second, albeit similar, language for the simpler stuff because they “should learn it”. Oh…and it’s also their job to remember when to use which. That’ll go well…The point is that in that context (which is the context of the themes in question) having a “blockquote” shortcode to mimick a blockquote tag makes sense because it’s allowing only 1 “language” to be learned and used instead of 2 (and lets remember, it’s our job to make it easy, not their job to learn HTML). Take it out of context as you put it and yeah…it sounds dumb. Put it back in and it’s actually pretty logical.
Should every theme have a zillion shortcodes? Nope, not if they don’t have features requiring it. And most don’t need it and don’t have it. Should some? Yes, ones with features needing it. And those do. But you seem to take the situations of themes in the former category out of context to use it as evidence to discredit themes in the latter category. I don’t believe you are doing this maliciously…but I do believe you don’t realize how capable and feature rich some WP themes have become to become part of that second category. That would not be possible if the approach of “just define CSS and make them learn HTML” was used.
This is what happens when someone misses the point completely. I’ll try to explain so that you can understand though.
No, I don’t. But, yeah, if you’re running your own Web site off WordPress, you probably should learn some rudimentary HTML.
Completely irrelevant to this discussion. Client work is outside the scope of the article.
I agree that shortcodes can and should be made for more complex things. Nowhere in my article did I state otherwise. But, if you’re going to argue the complexity angle, then you must explain why this shortcode is better within a theme than within a plugin (its proper place).
The user will not be locked in using a class at all. We’re talking about content here, not design. Changing designs is the point of changing themes.
Actually, you have that a little backwards. Making shortcodes forces the user to learn two “languages” rather than one. Whether you want it or not, the user will eventually have to touch some HTML. But, all that’s really beside the point.
As I’ve said numerous times in the comments above, this post has nothing to do with client work. As I said in the post itself, create a plugin if you want to make shortcodes.
On the note of client work though: If you’re forcing your clients (those that don’t know HTML) to learn shortcodes at all, then you’re doing it wrong. The admin should be much easier to use than that for them.
Experience from past 2 months support of a premium theme – even with videos and documentation some WP newbies have hard time clicking the menus, what’s left for learning HTML. With hundreds of shiny themes from themeforest, woothemes, elegant themes etc people are looking for color pickers, layout managers and drag&drop stuff wherever possible. Shortcodes are pain indeed, that’s why theme frameworks has large communities (you stick to a shortcode, but you still have 30 themes you could switch to/from).
I’ve tried to keep the number of our shortcodes reduced by using a few with classes or dropdowns for different styles in the shortcode editor but it was nightmare. Every action beyond naming and blog content that requires a keyboard is issue for lots of people with no technical background.
I’ve been using Prestige Themeforest by Digical Cavalry for a few months now and they look great. While the shortcodes made it easy to do a lot of things, it’s also the reason why I procrastinated so much. I was reluctant to put in the work only for it to go to waste one day when it ceases to become compatible with the latest version of wordpress.
Anyone know any “star rating” plugin similar to the one in Prestige? It’s the best I’ve seen so far but I’ll be changing my theme (to Genesis) soon so I need a plugin.
I really like when a theme has useful short codes but some are so counterintuitive. I really hate when some theme’s short codes attempt to manipulate or replace native Wordpress functionality.
I was testing out one theme that actually had a short code for hyper linking to external web pages. That’s the most basic HTML and wp’s tinymce option for adding hyperlinks is so much easier/better!
Let’s say we were once foolish in our youth. We installed a theme with bunches of “lazy” shortcodes or maybe even installed a very POPular plugin that uses lots of shortcodes… and now we want to uninstall the offending plugin/theme.
How do we get rid of all the orphaned shortcodes that appear in all the posts? I tried;
though that didn’t seem to work. And, I’ve tried search and replace via MySQL query I that is way too risky for a lousy typist like me. Any other ideas? Thanks!!
Hi Justin,
Great discussion. One thing that bothers me is the idea that we need to accomplish this through another plugin. We are advised to keep plugins to the minimum, but your suggestion is to avoid theme shortcodes and add another plugin.
I try to keep my plugin counts low, but all too often I need to add features that are only available with a plugin. Soon I have to scroll through several pages of active plugins.
This isn’t a problem on a simple site, but as sites become more complex there is a definite balance between adding desired features and plugin bloat. Add in the fact that certain plugins are incompatible with each other and adding yet-another-plugin could be a cure worse than the disease.
Not saying you are wrong to recommend against theme lock in, but I think we need to turn up the heat on WordPress to provide a Visual Editor that doesn’t strip legitimate HTML code rather than increasing the amount of plugins in our sites.
Thanks
I think the main problem here is most WordPress users are unable to code the intricate layouts or content blocks they want their content to contain, and shortcodes in some part fullfils this for some, but shouldn’t we be looking at how to extend the WYSIWYG editor to be more powerful for these types of users instead? ALA Dreamweaver design view? Then they could have some insert tools will parameters they can modify to suite their requirements like CSS settings per content block which can be edited by clicking the block’s design view handle similar to how we edit images once inserted? This approach could still render pure HTML in the editor, but could be setup to prevent WYSIWYG breakages by preventing partly destroying a content block the way many users end up doing with hidden HTML. Whoever comes up with a plugin that packages this in a user friendly manner will be bale to make a ton of money, it could even include built in post templates etc.
May also be worth mentioning the headache shortcodes cause as the net goes mobile and developers are dealing more with mobile versions of desktop sites. Especially in terms of Wordpress themes…if you’re working with one that’s shortcoded up the wazoo and then set up a theme switch for mobile users… What once seemed a nifty and simplified solution has just turned into something majorly impractical.
Hi Justin
Moving a site from one theme framework to another and what do I find… shortcodes!
What did you call it “the lock in effect”
Taking me so long to sort it out!
One thing I did learn is that the page source code actually shows the html of the shortcode so I can paste that into the page instead of the shortcode and then just style it.
With you all the way omn this one.
I think that instead of building the shortcodes in to the themes, we as developers should create a plugin that comes with the theme and this way, all shortcodes are still usable even in the event that our customers decide to switch themes.
I love the shortcode plugin by Elegant Themes and I love the shortcodes that beautify themeforest themes but I have definitely run into the special hell of changing a site with 100+multimedia posts all carefully styled using specific to the theme shortcodes. Can everyone just say [one_third] instead of making up their own variation? I am one if those annoying designers, not a developer, and my clients do not want to learn html…I barely want to but I do it. Plugins, if they were flexible with custom colors are good! red, green yellow….no custom color! yikes! What about hybrid’s plugins that say they are specifically for hybrid themes and use hybrid hooks. How is that really different in terms if locked in? Maybe it is, I don’t know. I apologize if I am repeating what others have said, Like my attention span for coding, I read about [three_fourthcol5] of these posts (wink wink)
Well, no, that’d be wrong.
]one_third]is a horrible name for the shortcode. Check out the Grid Columns plugin for a column shortcode plugin that works correctly.That’s between you and your clients. I’d argue anyone who wants to be a webmaster should know some basic HTML. And, yes, you’re a webmaster if you’re running your own WordPress install.
Build the plugin if you can’t find one you like. If you can’t build a plugin to handle such simple functionality, you shouldn’t be getting paid to build client sites on top of WordPress. You’re not ready yet.
I’m guessing you haven’t used the plugins. If you had, you’d be able to tell right off the bat that you’re not locked into using them when you change themes.
Excellent article.
For bits of “presentational markup” (and that’s exactly what theme developers “misuse” the Shortcode API for and why they stuff it into their themes rather than a plugin) I think it is best to use the AddQuicktag plugin (http://wordpress.org/extend/plugins/addquicktag/).
It inserts the real HTML that I previously created as “quicktags” on the plugin’s settings page (where you can also import/export them) via a dropdown in the editor.
So I can give every client the same snippets (for buttons, columns, etc. with sample content that he or she needs to replace) and style them differently. And even if the client moves away from me with his or her database full of content or needs a different CMS, there is still only pure HTML in the contents, no ugly shortcodes.
The only downside is that there is no easy way to change all the inserted snippets at once later on, but ideally, that should not be the case in the first place. Because if the content is marked up correctly, why should I need to change it later on? Only for presentational reasons, but I should not change the markup in order to change the outcome, I should change its CSS (ideally).
What do you think?
Any thoughts, Justin, on my previous comment? (I am in no way affiliated with the mentioned plugin.)
Surely the benefit of using shortcodes over html tags is that you can use them in the visual editor without worrying about them being stripped out.
It also means that you can have complex html markup in the post/page and still allow the user with limited html knowledge to amend document styles without having to delve right in to the html view.
What does that have to do with themes? If you want to install a plugin that does that, then by all means, go for it.
There have been numerous examples in the comments here that have provided great solutions for basic HTML. For complex HTML, I’d probably go with a shortcode too, but it’d still exist within a plugin.
Thanks for this post, it answered exactly what I was trying to find out which is wtf happens with the shortcode when you decide to move to another theme. Would it make sense to use consistent html and then create a separate stylesheet that you can easily take with you to any theme you might switch to?
On another note, this site is perfectly designed. From the layout to the font. I read the entire article because of that, which is rare.
I have a few bits of HTML that I carry with me from theme to theme. I generally just add the style rules for them to my
style.css, but keeping a separate stylesheet makes a little more sense.The main benefit, in my opinion, is that the shortcode is visible in the Visual Editor, where HTML can easily be deleted, or partially deleted. If the editor backspaces over part of a div, the entire layout is off kilter. Another alternate method I’ve found helpful is to add buttons to the editor where the user can highlight text and hit a button that will add the appropriate HTML.
It’s not really about the advantages vs. disadvantages of shortcodes and HTML. It’s more about proper development practices. If you want shortcodes to handle basic HTML, that’s all well and fine. They just belong in a plugin, not in a theme.