Introducing Shortcake v0.3.0 “Butter”

Fusion’s first major open-source project was introduced in November as Shortcake. Shortcake makes WordPress shortcodes a piece of cake. Shortcodes are a core component of WordPress structured publishing. With Shortcake we give shortcodes a visual interface to make shortcodes as user-friendly as they are powerful.

Today we’re introducing Butter, the third major release of Shortcake.

What’s new?

Breaking change: content is now inner_content

If you previously created shortcode UI using Shortcake for an element with an inner content field. you’ll need to change the element’s registration code.

Prior to v0.3, you could register your UI like this:

In v0.3 and beyond, you’ll need to register UI for your inner_content field like this:

New field: Post select

In Shortcake v0.3.0, you can use the post select field to offer your users the ability to pick from a list of posts. See how we’re using it on Fusion to let editorial pick from videos to insert into a post:

Select from videos to insert into a post

The post select field supports a query registration argument to let you limit the list to a particular subset of your content. If you’re familiar with WP_Query, you’re already up to speed on the arguments you can use.

Include arbitrary HTML attributes in your fields

When registering a field for a given shortcode attribute, you can use the meta argument to define arbitrary HTML attributes for the field.

Important note: If you’ve used the placeholder argument for any of your shortcode attributes, you should take the time to migrate the argument under the meta argument. We’ll be removing our compatibility shim for this change in v0.4.0.

Additional changes in v0.3.0

Enhancements:

  • When inserting a shortcode, a helpful message will be displayed when the shortcode doesn’t have attributes to configure. Previously, the user was presented with a relatively blank screen.
  • Our example plugin can now be activated through the WordPress admin. This makes it much easier to explore the plugin.
  • Clicking “Insert Post Element” in the left menu effectively acts as back button to the shortcode selection screen.
  • Language around the editing experience reflects the shortcode you’re editing. For instance, with a pullquote shortcode, “Edit Post Element” becomes “Edit Pullquote”.
  • Added Dutch translation.
  • Source JavaScript files moved to js/src for clarity between source and built JavaScript.
  • PHP files are scanned using PHP_CodeSniffer.

Bug fixes:

  • Unquoted shortcode attributes are properly supported.
  • Attachment field properly registers dependencies.
  • “Insert Post Element” experience should work when visual editor is disabled. Shortcake is only loosely coupled with TinyMCE.
  • Editor styles are loaded on `after_setup_theme` to prevent fatals.

Take a look in Github for all closed issues in this release.

Want to get involved in development? Join us in an upcoming WordPress.org Slack chat.

×
To Watch This Video

Select your TV provider, sign in and watch!

More providers to come soon.