197 Responses

  1. Roy
    Roy Published |

    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.

    Reply
    1. Bhargav Raut
      Bhargav Raut Published |

      “”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.

      Reply
  2. Sherman
    Sherman Published |

    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.

    Reply
  3. Sherman
    Sherman Published |

    Also: can’t you just add classes to the TinyMCE drop-down menu or is that locked in?

    Reply
    1. Jan Fabry
      Jan Fabry Published |

      Adding it to the styles dropdown is really easy:

      add_filter('mce_buttons_2', 'wpse3882_mce_buttons_2');
      function wpse3882_mce_buttons_2($buttons)
      {
          array_unshift($buttons, 'styleselect');
          return $buttons;
      }
      
      add_filter('tiny_mce_before_init', 'wpse3882_tiny_mce_before_init');
      function wpse3882_tiny_mce_before_init($settings)
      {
          $style_formats = array(
              array('title' => 'Note', 'block' => 'p', 'classes' => 'note'),
          );
          $settings['style_formats'] = json_encode( $style_formats );
      
          return $settings;
      }

      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?”.

      Reply
      1. Mel
        Mel Published |

        That’s AWESOME. I’m so doing this!

      2. Ron
        Ron Published |

        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.

      3. Nick
        Nick Published |

        Very cool. Learning to love TinyMCE.

  4. Matthew Muro
    Matthew Muro Published |

    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.

    Reply
  5. Alexis
    Alexis Published |

    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.

    Reply
  6. Kristjan
    Kristjan Published |

    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?

    Reply
  7. Luke Weese
    Luke Weese Published |

    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!

    Reply
  8. Federico
    Federico Published |

    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.

    Reply
  9. Dorian Speed
    Dorian Speed Published |

    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!

    Reply
  10. Bill Robbins
    Bill Robbins Published |

    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.

    Reply
  11. Ken Newman
    Ken Newman Published |

    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.

    Reply
  12. John Blackbourn
    John Blackbourn Published |

    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?

    Reply
    1. Kilwag
      Kilwag Published |

      I agree that it might be 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.

      I strongly disagree with expanding the list of standard shortcodes. The effect on portability outweighs any advantage. Highlighting text or paragraphs could be done in with the a reworked visual editor. If you’re going to teach people how to use an expanded set of short codes, why not teach them how to use basic standard HTML/CSS instead? Seems more inline with Wordpress ideals.

      Reply
  13. Sayontan
    Sayontan Published |

    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.

    Reply
  14. Matt Varone
    Matt Varone Published |

    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.

    Reply
  15. ryanve
    ryanve Published |

    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.

    Reply
    1. Cory
      Cory Published |

      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 ;-)

      Reply
  16. Shawn
    Shawn Published |

    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.

    Reply
  17. Joss Crowcroft
    Joss Crowcroft Published |

    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..

    Reply
  18. Ryan
    Ryan Published |

    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.

    Reply
    1. Shawn
      Shawn Published |

      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!)

      Reply
  19. Jimbo
    Jimbo Published |

    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?

    Reply
  20. quicoto
    quicoto Published |

    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

    Reply
  21. Sean Barton
    Sean Barton Published |

    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

    Reply
  22. Adria Richards
    Adria Richards Published |

    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.

    Reply
  23. Phill Brown
    Phill Brown Published |

    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.

    Reply
  24. Edward Caissie
    Edward Caissie Published |

    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.

    Reply
  25. Jamal
    Jamal Published |

    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,

    Reply
  26. Erik Ford
    Erik Ford Published |

    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.

    Reply
    1. Shawn
      Shawn Published |

      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!

      Reply
  27. Diana
    Diana Published |

    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.

    Reply
  28. Mike
    Mike Published |

    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.

    Reply
    1. that girl again
      that girl again Published |

      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.

      Reply
  29. Daryl
    Daryl Published |

    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.

    Reply
  30. Rob
    Rob Published |

    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.

    Reply
  31. Dan
    Dan Published |

    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.

    Reply
  32. marge at large
    marge at large Published |

    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?

    Reply
    1. Mike
      Mike Published |

      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.

      Reply
  33. Corrinda
    Corrinda Published |

    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

    Reply
  34. Hassan
    Hassan Published |

    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.

    Reply
    1. Bob Keen
      Bob Keen Published |

      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.

      Reply
      1. Hassan
        Hassan Published |

        I meant from the design point of view. The design of [button] and even [accordion] are up to themes.

  35. WordPress Community Links: Contributing without code edition | WPCandy
  36. Jess Planck
    Jess Planck Published |

    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

    Reply
  37. Random Joe
    Random Joe Published |

    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

    Reply
  38. How to create your own WordPress functionality plugin | WPCandy
  39. Neil
    Neil Published |

    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.

    Reply
  40. Neal Morgan
    Neal Morgan Published |

    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.

    Reply
  41. Wordpress: Adding custom buttons to TinyMCE | | Unrelated MediaUnrelated Media
  42. Neil
    Neil Published |

    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.

    Reply
  43. Paul
    Paul Published |

    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.

    Reply
  44. Larry Tartisel
    Larry Tartisel Published |

    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.

    Reply
  45. How to Add Buttons and CSS Classes to TinyMCE : WP Mayor
  46. Neil
    Neil Published |

    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

    'UPDATE wp_post SET post_content = replace(post_content, ‘[tweet]‘, ” ) WHERE post_content LIKE ‘%\\[tweet\\]%’;'

    from http://www.wprecipes.com/wordpress-tip-get-rid-of-unused-shortcodes

    Reply
  47. Caleb
    Caleb Published |

    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!

    Reply
  48. carl shreder
    carl shreder Published |

    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…

    Reply
  49. Puneet Sahalot
    Puneet Sahalot Published |

    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. :)

    Reply
  50. Denzel Chia
    Denzel Chia Published |

    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

    Reply
  51. Gerry Xanders
    Gerry Xanders Published |

    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

    Reply
  52. Jacob Hopson
    Jacob Hopson Published |

    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

    Reply
  53. David J
    David J Published |

    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?

    Reply
    1. Trisha Cupra
      Trisha Cupra Published |

      David J – I was just looking at how to do that today at http://www.sycha.com/wordpress-assign-custom-css-classes-visual-editor/

      Reply
  54. Neil
    Neil Published |

    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.

    Reply
    1. Trisha Cupra
      Trisha Cupra Published |

      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?

      Reply
      1. Neil
        Neil Published |

        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!

  55. carl shreder
    carl shreder Published |

    Hello Justin! I just wanted to find our the way you guys publish psd to wordpress? Any ideas fro me to follow gladly?

    Reply
  56. Jeff
    Jeff Published |

    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

    Reply
  57. EMMA
    EMMA Published |

    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..

    Reply
  58. Ana Wellbeing
    Ana Wellbeing Published |

    @ema
    Thannks for the divine plugin. I started to use… For now all works correct. On which way you think to improve it?

    Reply
  59. frank
    frank Published |

    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.

    Reply
  60. Jon Blumenfeld
    Jon Blumenfeld Published |

    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.

    Reply
  61. DPXradar 001 – Link Roundup for Online Business Owners
  62. Frank McClung
    Frank McClung Published |

    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.

    Reply
  63. What to do about shortcodes? | unhack WP
  64. Reji Thomas
    Reji Thomas Published |

    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. :)

    Reply
  65. web hosting
    web hosting Published |

    Thanks, really it’s a very great post I loved it very much and I loved this website so I bookmarked it.

    Reply
  66. Croata
    Croata Published |

    you say to create a style, but even creating a style, when you change theme, you no longer will have that style!

    Reply
  67. unu
    unu Published |

    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

    Reply
  68. An Alternative to the Shortcode Madness [Part 1] | Theme.it
  69. How to create your own WordPress functionality plugin - Wordpress Tutorials
  70. Check out Justin’s blog post http justintadlock com… « WordCamp LA LIVE
  71. leeuniverse
    leeuniverse Published |

    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…..

    Reply
  72. Mary
    Mary Published |

    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.

    Reply
  73. Andre
    Andre Published |

    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.

    Reply
  74. Matth
    Matth Published |

    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.

    Reply
  75. Amy
    Amy Published |

    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.

    Reply
  76. Jenn Colgan
    Jenn Colgan Published |

    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!

    Reply
  77. Bryan
    Bryan Published |

    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.

    Reply
  78. WordPressショートコードの狂気と向き合う | 高橋文樹.com
  79. Shortcode Ultimate | WP Guides
    Shortcode Ultimate | WP Guides at |
  80. Mario Peshev
    Mario Peshev Published |

    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.

    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.

    Reply
  81. Jonsky
    Jonsky Published |

    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.

    Reply
  82. Chris Vendilli
    Chris Vendilli Published |

    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!

    Reply
  83. David Radovanovic
    David Radovanovic Published |

    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;

    add_shortcode('nggallery', 'my_remove_shortcode');
    function my_remove_shortcode(){
    	return '';
    }

    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!!

    Reply
  84. Tom Bonner
    Tom Bonner Published |

    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

    Reply
  85. nomad-one
    nomad-one Published |

    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.

    Reply
  86. Sarah
    Sarah Published |

    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.

    Reply
  87. Some Business Thoughts For WordPress - Sparq Vault
  88. Building plugin-like functionality into WordPress themes
  89. Keith Davis
    Keith Davis Published |

    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.

    Reply
  90. Atlante Avila
    Atlante Avila Published |

    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.

    Reply
  91. Kate
    Kate Published |

    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)

    Reply
  92. Danilo
    Danilo Published |

    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?

    Reply
  93. Disallow specific shortcodes in post content
  94. Danilo
    Danilo Published |

    Any thoughts, Justin, on my previous comment? (I am in no way affiliated with the mentioned plugin.)

    Reply
  95. Peter
    Peter Published |

    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.

    Reply
  96. neono
    neono Published |

    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.

    Reply
  97. Never Lock Users into Your WordPress Themes | ThematoSoup
  98. Amy
    Amy Published |

    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.

    Reply
  99. Persona - Responsive AJAX Blog and Portfolio WordPress Theme
  100. Skematik | jazzsequencejazzsequence
  101. 5 Reasons Why WordPress is Amazing — Moore Creative Ideas
  102. The two greatest WordPress plugins that every website NEEDS (not really) Rami Abraham | Rami Abraham - Music, Code, Also Other Things
  103. Some Web Guy
    Some Web Guy Published |

    I just have one simple question, how would you put lets say accordion or any other more complex shortcode in the middle of your post with plugin?

    Reply
  104. Shortcodes Should Never Be Included With Themes. Period. | Theme Lab
  105. Karen Walters
    Karen Walters Published |

    That’s good information. I’ve been searching for a way to simply add these, I appreciate it.

    Reply
  106. The ThemeForest Experiment: One Year Later
    The ThemeForest Experiment: One Year Later at |
  107. Why custom post types belong in plugins
    Why custom post types belong in plugins at |
  108. A short farewell to shortcodes | One Billion Words
  109. DerSiedler
    DerSiedler Published |

    Never thought of the problem with shortcodes. But you’re absolutely right. Using another theme from a different author ruins the style. The discussion is 2 years old. Does anyone know if there is a plugin now?

    Reply
  110. Behind the Design of the Forefront theme | ThemeShaper
  111. Susan Paigen
    Susan Paigen Published |

    The limitation of shortcodes – that you’re then tied to the theme or plugin which generates the shortcodes – is important. And although the advantage of putting them plugins instead of themes is clear, there are also problems with plugin conflicts. I found this post researching because of conflicts generated by 2 different popular post-content plugins.

    For many of my clients the problem with using basic html markup instead of shortcodes is not the difference between [code]blah blah blah[/code] and

    blah blah blah

    , it’s the difference between working in the visual editor and working in the text editor, where it’s hard to distinguish between content and markup. I’ve been writing html for years, but even I find that, without the color coding I rely on in a text editor, keeping track of what I’m doing and where I am in the text editor is a pain in the a.. and I use the visual editor pane whenever I can.

    Adding the TinyMCE Advanced plugin lets the user can add classes from the editor-style stylesheet in the visual editor pane, but the functionality is limited – only one class can be added to each tag, and if the styling starts to layer the system quickly gets mucked up.

    A plugin that color-codes the text editor pane like text editor programs would be a godsend!! Anybody interested?

    Reply
    1. Susan Paigen
      Susan Paigen Published |

      Sorry, the second blah blah blah was wrapped in div code, which got stripped out.

      Reply
  112. WordPress Theme Users: Avoid the Lock-in Effect - churchthemes.com
  113. Carlos
    Carlos Published |

    There is one reason that I create and use shortcodes in place of HTML inside WordPress page content for client sites.

    Because WordPress MESSES the nicely formatted HTML code up! Mangles it. Replaces tags. And otherwise makes it all but unreadable at first glance. IT WONT LEAVE MY CODE ALONE!

    So…rather than fighting with the Tiny whatever editor I just did an end run and started creating shortcodes that are defined inside my custom_functions.php file where my code is out of WordPress’s reach (so to speak). Problem solved.

    True…it does tie the client to using whatever theme they have on the site when I work on it but clients don’t go changing themes on a whim. To change a theme at the sites I work on is like changing a web site and recreating it. Not something my clients are likely to do very often if at all.

    Carlos

    Reply

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php