Advertisement
mikelittle

wp_editor() example

Nov 24th, 2011
2,596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. <?php
  2.  
  3. add_action('admin_menu', 'wp_editor_test_menu');
  4. function wp_editor_test_menu() {
  5.     add_menu_page('wp_editor', 'wp_editor', 'read', 'wp_editor', 'wp_editor_test_page');
  6. }
  7. function wp_editor_test_page() {
  8.     echo '<div class="wrap"><h2>wp_editor()</h2>';
  9.  
  10.     $content = '';
  11.     $id = 'editor-test';
  12.     $settings = array(
  13.         'quicktags' => array(
  14.             'buttons' => 'em,strong,link',
  15.         ),
  16.         'quicktags' => true,
  17.         'tinymce' => true
  18.     );
  19.  
  20.     wp_editor($content, $id, $settings);
  21.  
  22.     echo '</div>';
  23.  
  24. }
  25.  
  26. /* $settings:
  27.     'wpautop' => true, // use wpautop?
  28.     'media_buttons' => true, // show insert/upload button(s)
  29.     'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
  30.     'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
  31.     'tabindex' => '',
  32.     'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
  33.     'editor_class' => '', // add extra class(es) to the editor textarea
  34.     'teeny' => false, // output the minimal editor config used in Press This
  35.     'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
  36.     'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
  37.     'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
  38. */
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement