Shortcake Is Now a WordPress Feature Plugin

photo credit: kendiala - cc
photo credit: kendialacc

Shortcake, a plugin that adds a UI to make shortcodes more user friendly, is now an official WordPress feature plugin. The project is led by Daniel Bachhuber, currently the interim director of engineering at Fusion, the company where Shortcake originated. Contributors include Matthew Haines-Young and the folks at Human Made.

The plugin is being developed on GitHub but is also now available for download on WordPress.org. Developers who want to utilize Shortcake can register a UI for their shortcodes alongside add_shortcode, which will expose Shortcake’s user-friendly interface.

Shortcake transforms your ordinary shortcode to render a preview in a TinyMCE view:

shortcake-demo

It also supplies a user-friendly UI to add shortcodes via the “Add Media” button. After selecting your shortcode, you’ll have the ability to edit its content and attributes.

insert-post-element

Version 0.2.0 enhances the post element interface in the following ways:

  • Shortcodes are sorted alphabetically, making it easier to skim and find shortcodes.
  • Shortcodes can be filtered by name using the “Search” field, reducing complexity when a site has many dozens of shortcodes.
  • The “Insert Element” button is disabled until a post element is selected, providing a visual cue to the user.

This release also makes a number of significant changes to the structure of the plugin. It has been retooled using an MVC architecture that relies on Browserify. Shortcake contributor Jitendra Harpalani explains the reasons behind the changes:

Specifically, we decided to use Browserify. It’s much easier to compartmentalize models, views, and controllers into different directories and then simply “require” them into your main JavaScript file, rather than having to create a self-contained and fully-fledged Backbone app.

Fortunately, WordPress core already uses Browserify to split apart the media library JavaScript, so it doesn’t introduce a new dependency.

Does Shortcake have a chance to make it into WordPress core?

Although shortcodes make it easy to insert and structure complex content, they’re an eyesore in the post editor. Including multiple shortcodes the old fashioned way can quickly become messy.

Shortcake is a well-conceived solution that brings new life to shortcodes and makes them significantly less confusing to implement. Contributors on the project believe in it enough to start working on the steps necessary to make the feature plugin ready to be proposed for core.

If it does land in core someday, it will be interesting to see how well the feature is adopted. If some developers register a UI for their shortcodes and others don’t, it could be confusing to know which shortcodes are available if they don’t show up on the “Insert Element” screen. Then again, that problem already exists without Shortcake. Without the help of an additional plugin, there’s no easy way to know which shortcodes are available.

If you think Shortcake has potential and want to get involved, follow the updates on make.wordpress.org/core and join the development team for a meeting on WordPress.org Slack.

14

14 responses to “Shortcake Is Now a WordPress Feature Plugin”

  1. I could see this being useful for standardizing some UI stuff for inserting shortcodes. I know I’d love to use it on a couple of projects. Allowing devs to register or not register a UI is the right way to go. There are many instances where having the shortcode output in TinyMCE would be disastrous.

  2. Shortcake is cool. I don’t think it should be in core at this point. Also, I’m not sure why they place the shortcode elements under “Add Media” – you should be able to create your own button in TinyMCE that when clicked will open a modal with only your plugin’s specific shortcodes to choose from. Again, I really like the concept behind Shortcake… there’s just some critical shortcomings yet to be addressed.

    • Scaling is the reason it makes sense to implement a UI that incorporates shortcode control within the Add Media modal or something similar.

      Just like a horizontal navigation doesn’t scale as good as a vertical navigation for menus, adding lots of buttons to the TinyMCE interface is just going to add clutter. Especially if you have a theme and plugins that incorporate a bunch of shortcode options.

      Then there is the issue of consistency. If each theme and plugin is adding icons that open up their own modals within the editor that means they are likely also using their own implementations for the workflow and UI rather than providing a consistent experience.

      Consistency is extremely important for user experience as well as simplifying UI’s for end users.

      From a non-technical user perspective being able to easily see the shortcodes at your disposal and be able to implement them in a consistent fashion would be a good thing.

      Right now it’s pretty much a crap shoot with plenty of themes and plugins not even providing a UI of any kind for implementing their shortcodes. This is a way for WordPress to provide the tools to make doing so a no brainer and by doing it in a way that is consistent from theme to theme and plugin to plugin.

      That is a good thing and it’s most definitely the direction WordPress should be looking to go in.

      • Very well thought out reply Carl, I agree with you on every point. Especially what you said about creating a consistent UI for shortcodes. As it is, it’s a mess. Some plugins add tinyMCE buttons, some like gravity forms add buttons near the add media button and other don’t have any way for you to know what shortcodes are available without digging through their documentation. It’s a nightmare and shortcake is a viable solution.

    • And out of curiosity, what exactly are the critical shortcomings you are referring to? Dislike of placing it within the “Add Media” modal aside… just curious what the issue is with the general direction.

  3. I love Shortcake. I’ve just been playing around with the previous version for a couple of weeks but thus far I’m finding it game changing in terms of what clients can do with their sites because it makes complicated designs editable in the editor and gives users much quicker visual feedback for what they’ve entered.

    From a developer standpoint, it’s super easy. I’m also reassured by the fact that it’s used on Fusion, which is all about the looking good and digital presence and feel confident it’s going work well for me, too. Actually, that’s what swayed me – seeing it running on a large site – I would have wanted to wait to use it otherwise.

    I don’t have it in production anywhere yet but it’ll definitely be a part of any future projects of mine. Better, easier, quicker and more flexible than the metaboxes I currently use for those things! (phew)

  4. Interesting the fact they used the media gallery instead of tinyMCE buttons, this makes it easily accessible in all recent builders which have tendency to play around with the tinyMCE editor.

    While this would be useful for dealing with legacy shortcodes, I still prefer to avoid giving shortcodes to end users. Once insert, they’re just a pain to deal with most of the time.

  5. Sarah, this is a tough one to call.

    By allowing plugin functionality like that found in Shortcake and/or Jetpack into core, WordPress begins to pull closer to alternatives like Squarespace and Wix as a more user-friendly site builder.

    Personally, I’m all for it. Jetpack, Shortcake, Conductor, and other user-friendly plugin solutions make WordPress a more viable platform for the future.

  6. I love Shortcake and I’ve contributed a few things to the project since I believe that it can drastically change things. We’ve also been using it in Page Builder Sandwich, our page builder plugin.

    However, as to whether Shortcake should be included into core, in it’s current state I’m not that sure. Would the few shortcodes included into WP use it? As a shortcode UI API, maybe.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.