How to use Wordpress Text Editor in a custom plugi

2019-02-15 22:53发布

How can we use default wordpress text editor for my wordpress plugin.Any suggections please?

4条回答
\"骚年 ilove
2楼-- · 2019-02-15 22:54

As of Wordpress 3.3 the_editor has deprecated in favor of wp_editor. wp_editor uses the new media uploader and takes advantage of all the new features of Wordpress 3.5.x Documentation here: http://codex.wordpress.org/Function_Reference/wp_editor

A very good example of how to use it can be found at Wptuts+ here: http://wp.tutsplus.com/articles/tips-articles/quick-tip-using-wp_editor/

查看更多
甜甜的少女心
3楼-- · 2019-02-15 23:03

Very easy:

<?php wp_editor( $content, $editor_id ); ?> 

This will generate a lot of html tags. But the one you will be interested in is the textarea with its name set to $editor_id. So when the form is submitted, you can save that content.

You can find more info here: https://codex.wordpress.org/Function_Reference/wp_editor

查看更多
Melony?
4楼-- · 2019-02-15 23:06

The WordPress Text editor is an application of the TinyMCE Editor. You can utilize the files located in wp_includes/js/tinymce and create an instance of the editor on your own, according to the documentation.

Check out these articles for example instructions:
http://www.keighl.com/2010/01/tinymce-in-wordpress-plugins/

http://wordpress.org/support/topic/how-i-can-use-tinymce-for-my-own-plugin

查看更多
ら.Afraid
5楼-- · 2019-02-15 23:11

very easy try this code it's working

 wp_editor( $distribution, 'distribution', array( 'theme_advanced_buttons1' => 'bold, italic, ul, pH, pH_min', "media_buttons" => true, "textarea_rows" => 8, "tabindex" => 4 ) );
查看更多
登录 后发表回答