[wp-hackers] Shortcodes and formatting

Andrew Ozz admin at laptoptips.ca
Tue Apr 1 22:59:43 GMT 2008


Andrew Ozz wrote:
> Andy Skelton wrote:
>> On Mon, Mar 31, 2008 at 12:46 PM, Duane Storey <duanestorey at gmail.com> 
>> wrote:
>>> The only thing I don't like about plugins that use shortcodes is that
>>>  if you disable the plugin, you're left with a bunch of markup that no
>>>  longer renders.
>>
>> Ditto. Proposal:
>>
>> On plugin deactivation, call null_shortcode($tag). This adds $tag to
>> an array stored in options table.
>>
>> On add_shortcode, check for $tag in null_shortcode array. If found,
>> remove it and update_option.
>>
>> On do_shortcode, replace tags in null_shortcode array with empty string.
> 
> That will work well except when the content is exported from one blog 
> and imported in another/new installation. The array with the old 
> shortcodes wouldn't be in the new db.
> 
> I still think that the format for shortcodes should be hidden in the 
> browser by default, like the <!--more--> and <!--nextpage--> tags that 
> have been working very well for some years now.
> 
> There are several options to show any type of shortcodes in TinyMCE, it 
> supports custom tags, or the "wordpress" plugin can be extended to 
> handle them similar to the <!--more--> tag, or we can modify and add the 
> "bbcode" plugin for TinyMCE, etc.

For example, if the shortcode format is <!--[shortcode]--> or
<!--[shortcode ...]...[/shortcode]-->, in TinyMCE we can easily filter 
<!--[ to <pre>[ (or any other tag) on input and filter it back to <!--[ 
on saving/switching to HTML mode. It can also be filtered to 
&lt;!--[shortcode]--&gt; and back to <!--[shortcode]-->, etc.

The standard <![CDATA[ ... ]]> can also be used.

That way the shortcodes will be editable both in Visual and HTML modes 
and could be pasted, typed, etc.


More information about the wp-hackers mailing list