wp-shortcake / shortcake

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

Ability to mark parameters as Required #132

Open bobbingwide opened 9 years ago

bobbingwide commented 9 years ago

Some shortcodes may operate successfully with no parameters whatsoever. Others require certain parameters to be set.

It would be nice if the preview did not get invoked if the required parameters were not defined.

methnen commented 9 years ago

Additionally you can insert a shortcode into a post before any required attributes have been added which results in something like this:

[shortcode ]

Would be nice if the same 'required' parameter for a UI field also disabled in the Insert Element button until all required parameters were filled out.

jrfnl commented 9 years ago

+10

cliffordp commented 9 years ago

Yes!

Prior to using Shortcake UI, I would do all the error checking inside the shortcode's code and output an HTML comment to help somewhat. However, returning an HTML comment in Shortcake Preview or WP Editor makes the shortcode not appear at all and displays an odd-height space.

If I return ''; instead of returning an HTML comment, Shortcake displays the shortcode text but without a preview (its own lite version of an error message).

Allowing to mark one or more attributes as required would be an effort toward giving user an idea of the essential settings and lessen the need for HTML comment sort of error message 'helping'.

nextgenthemes commented 8 years ago

+1

jphorn commented 8 years ago

+100. We badly need this to make some of our shortcodes work in a team environment (without writing a 100-page guidebook)