wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
664 stars 143 forks source link

Shortcake (Shortcode UI)

Contributors: fusionengineering, mattheu, danielbachhuber, zebulonj, goldenapples, jitendraharpalani, sanchothefat, bfintal, davisshaver, garyj, mte90, fredserva, khromov, bronsonquick, dashaluna, mehigh, sc0ttkclark, kraftner, pravdomil
Tags: shortcodes
Requires at least: 4.5
Tested up to: 5.0.3
Stable tag: 0.7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Shortcake makes using WordPress shortcodes a piece of cake.

Description

Used alongside add_shortcode, Shortcake supplies a user-friendly interface for adding a shortcode to a post, and viewing and editing it from within the content editor.

Once you've installed the plugin, you'll need to register UI for your shortcodes. For inspiration, check out examples of Shortcake in the wild.

To report bugs or feature requests, please use Github issues.

Installation

Shortcake can be installed like any other WordPress plugin.

Once you've done so, you'll need to register the UI for your code.

New in 0.4.0 is the ability to attach javascript functions to event attribute updates. Action hooks can be used to dynamically show or hide a field based on the value of another, or to implement custom validation rules.

Frequently Asked Questions

How do I register UI for arbitrary key/value pairs as shortcode attributes?

Shortcake doesn't support custom key => value pairs as shortcode attributes because it isn't a great user experience.

After upgrading to Shortcake 0.7.x, some of the shortcode UI fields (post select, user select, etc) don't work as expected. What can I do?

In version 0.7.0, we updated to the most recent branch of the Select2 library, which provides the enhanced select fields in these field types. This causes a known conflict with plugins that enqueue older versions of Select2. (Popular plugins with known conflicts include WooCommerce and Advanced Custom Fields Pro, among others.)

If you find that you're experiencing conflicts with these plugins, you can set a flag to load select2 in a distinct namespace by defining the constant SELECT2_NOCONFLICT in your wp-config.php (or anywhere that's defined before the 'init' hook.)

define( 'SELECT2_NOCONFLICT', true );

Running tests

We have test coverage for PHP using PHPunit, and JavaScript using Jasmine.

Running tests locally

Jasmine tests can be run using grunt jasmine and are also run as part of the grunt scripts task. To update the core WordPress files used by the Jasmine test suite, run grunt updateJasmineCoreScripts --abspath="/path/to/wordpress-install".

Screenshots

1. Without Shortcake, shortcodes have a minimal UI.

Without Shortcake, shortcodes have a minimal UI.

2. But with Shortcake, TinyMCE will render the shortcode in a TinyMCE view.

But with Shortcake, TinyMCE will render the shortcode in a TinyMCE view.

3. And add a user-friendly UI to edit shortcode content and attributes.

And add a user-friendly UI to edit shortcode content and attributes.

4. Add new shortcodes to your post through "Add Media".

Add new shortcodes to your post through "Add Media".

Upgrade Notice

0.4.0

We've removed the compatibility shim for the placeholder attribute argument. You should register a placeholder for your field using the meta argument.

0.3.0

We've removed the compatibility shim for the magical content attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use inner_content.

Changelog

0.7.4 (January 16, 2019)

0.7.3 (September 5, 2017)

0.7.2 (April 24, 2017)

0.7.1 (March 16, 2017)

0.7.0 (November 18, 2016)

0.6.2 (November 12, 2015)

0.6.1 (November 9, 2015)

0.6.0 (November 2, 2015)

0.5.0 (August 26, 2015)

0.4.0 (June 22, 2015)

0.3.0 (April 27, 2015)

0.2.3 (April 8, 2015)

0.2.2 (April 6, 2015)

0.2.1 (March 18, 2015)

0.2.0 (March 18, 2015)

0.1.0 (December 23, 2014)