Plugin for adding rich text editing capabilities to textareas in Shortcake.
Author: | XWP (profile at wordpress.org) |
WordPress version required: | 4.5 |
WordPress version tested: | 4.9.4 |
Plugin version: | 1.3 |
Added to WordPress repository: | 26-08-2016 |
Last updated: | 24-03-2018
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 0 |
Rated by: | 0 |
Plugin URI: | https://github.com/xwp/wp-shortcode-ui-richte... |
Total downloads: | 23 153 |
Active installs: | 500+ |
Click to start download
|
Screenshots
This screenshot shows a rich text enabled textarea in the Shortcake interface.
FAQ
Installation Instructions
You need the latest version of of [Shortcake (Shortcode UI)] installed and activated.
- Upload the plugin files to the
/wp-content/plugins/shortcode-ui-richtext
directory.
- Activate the plugin through the ‘Plugins’ screen in WordPress
- Add the meta class option to the textarea input type of an existing shortcake register_for_shortcode call.
- Due to the possibility of the user entered content to contain special characters like [, ] and “, it is highly recommended to turn on the encode flag as well.
php
'encode' => true,
'meta' => array(
'class' => 'shortcake-richtext',
),
How does an example rich textarea input element shortcake register code looks like?
This is a default shortcode with a single textarea:
`php
shortcode_ui_register_for_shortcode( ‘shortcode_name’,
array(
‘label’ => esc_html__( ‘Shortcode Name’, ‘namespace’ ),
‘listItemImage’ => ‘dashicons-text’,
‘attrs’ => array(
array(
‘label’ => esc_html__( ‘Text Element’, ‘namespace’ ),
‘attr’ => ‘text_element’,
‘type’ => ‘textarea’,
),
),
)
);
`
This is the same code with the richtext capability added in on the text_element:
`php
shortcode_ui_register_for_shortcode( ‘shortcode_name’,
array(
‘label’ => esc_html__( ‘Shortcode Name’, ‘namespace’ ),
‘listItemImage’ => ‘dashicons-text’,
‘attrs’ => array(
array(
‘label’ => esc_html__( ‘Text Element’, ‘namespace’ ),
‘attr’ => ‘text_element’,
‘type’ => ‘textarea’,
‘encode’ => true,
‘meta’ => array(
‘class’ => ‘shortcake-richtext’,
),
),
),
)
);
`
Outputting requires decoding, and since Shortcake uses url encoding, the attribute powered by the rich text editor needs to be urldecoded before rendering its contents, like in the following example using the urldecode
function:
`php
function shortcode_name( $atts ) {
extract( shortcode_atts(
array(
‘text_element’ => ”,
),
$atts
));
return ‘
‘ . urldecode( $text_element ) . ‘
‘;
}
`
This doesn’t work although I added the class according to the instructions. Am I missing anything?
Before submitting a report on the GitHub Issue tracker, please ensure the issue you are experiencing does not exist with using the latest Shortcake (Shortcode UI) version downloaded from their own GitHub repository.
ChangeLog
0.1 (August 19, 2016)
Initial release.
0.2 (October 3, 2016)
Modified SummerNote default configuration to initialise a toolbar which is more WordPress-friendly.
Added more examples to the readme.
Ads default rich text editing to the shortcode inner_content.
1.0 (April 25, 2017)
Replaced SummerNote by highly requested TinyMCE for a familiar WordPress experience.
1.1 (September 11, 2017)
“Add Media” button is now present next to the TinyMCE editor.
1.2 (March 15, 2018)
Fixes issues with multiple editors on page and timing issues with initialising and unloading TinyMCE.
1.3 (March 24, 2018)
Fix active editor modal bug occurring when multiple fields had editors.