Title: Shortcake (Shortcode UI) Richtext
Author: Mike Crantea
Published: <strong>2016 年 8 月 26 日</strong>
Last modified: 2018 年 3 月 24 日

---

搜索插件

![](https://ps.w.org/shortcode-ui-richtext/assets/banner-772x250.png?rev=1644193)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/shortcode-ui-richtext/assets/icon-256x256.png?rev=1644193)

# Shortcake (Shortcode UI) Richtext

 作者：[Mike Crantea](https://profiles.wordpress.org/mihai2u/)

[下载](https://downloads.wordpress.org/plugin/shortcode-ui-richtext.zip)

 * [详情](https://cn.wordpress.org/plugins/shortcode-ui-richtext/#description)
 * [评价](https://cn.wordpress.org/plugins/shortcode-ui-richtext/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/shortcode-ui-richtext/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/shortcode-ui-richtext/#developers)

 [支持](https://wordpress.org/support/plugin/shortcode-ui-richtext/)

## 描述

This plug-in extends on the capabilities of [Shortcake (Shortcode UI)](https://en.wordpress.org/plugins/shortcode-ui/)
by adding rich text editing capabilities to textarea inputs in the Shortcake interface,
when the specific textarea constructors contain the shortcake-richtext class name.

It uses [TinyMCE](https://www.tinymce.com).

## 屏幕截图

 * [[
 * This screenshot shows a rich text enabled textarea in the Shortcake interface.

## 安装

You need the latest version of of [Shortcake (Shortcode UI)] installed and activated.

 1. Upload the plugin files to the `/wp-content/plugins/shortcode-ui-richtext` directory.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Add the meta class option to the textarea input type of an existing shortcake register_for_shortcode
    call.
 4. 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', ),

## 常见问题

  Installation Instructions

You need the latest version of of [Shortcake (Shortcode UI)] installed and activated.

 1. Upload the plugin files to the `/wp-content/plugins/shortcode-ui-richtext` directory.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Add the meta class option to the textarea input type of an existing shortcake register_for_shortcode
    call.
 4. 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](http://php.net/manual/ro/function.urldecode.php):

    ```
    `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](https://github.com/xwp/wp-shortcode-ui-richtext/issues),
please ensure the issue you are experiencing does not exist with using the latest
Shortcake (Shortcode UI) version downloaded from their own [GitHub repository](https://github.com/wp-shortcake/shortcake).

## 评价

此插件暂无评价。

## 贡献者及开发者

「Shortcake (Shortcode UI) Richtext」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Mike Crantea ](https://profiles.wordpress.org/mihai2u/)
 *   [ XWP ](https://profiles.wordpress.org/xwp/)
 *   [ Ben Greeley ](https://profiles.wordpress.org/bengreeley/)

[帮助将「Shortcake (Shortcode UI) Richtext」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/shortcode-ui-richtext)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/shortcode-ui-richtext/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/shortcode-ui-richtext/)，或通过[RSS](https://plugins.trac.wordpress.org/log/shortcode-ui-richtext/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/shortcode-ui-richtext/)。

## 更新日志

#### 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.

## 额外信息

 *  版本 **1.3**
 *  最后更新：**8 年前**
 *  活跃安装数量 **200+**
 *  WordPress 版本 ** 4.5 或更高版本 **
 *  已测试的最高版本为 **4.9.29**
 *  语言
 * [English (US)](https://wordpress.org/plugins/shortcode-ui-richtext/)
 * 标签
 * [shortcodes](https://cn.wordpress.org/plugins/tags/shortcodes/)
 *  [高级视图](https://cn.wordpress.org/plugins/shortcode-ui-richtext/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/shortcode-ui-richtext/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/shortcode-ui-richtext/reviews/)

## 贡献者

 *   [ Mike Crantea ](https://profiles.wordpress.org/mihai2u/)
 *   [ XWP ](https://profiles.wordpress.org/xwp/)
 *   [ Ben Greeley ](https://profiles.wordpress.org/bengreeley/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/shortcode-ui-richtext/)