Skip to content

Instantly share code, notes, and snippets.

@vishalbasnet23
Created December 4, 2017 10:35
Show Gist options
  • Save vishalbasnet23/ac02e3c4d4a6d580e4de74f1b5a07eeb to your computer and use it in GitHub Desktop.
Save vishalbasnet23/ac02e3c4d4a6d580e4de74f1b5a07eeb to your computer and use it in GitHub Desktop.
Front-end WP Editor
<?php
function wp_editor_helper( $field ) {
$key = $field['name'];
$editor = array(
'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
'media_buttons' => false,
'textarea_rows' => 8,
'quicktags' => false,
'tinymce' => array(
'plugins' => 'lists,paste,tabfocus,wplink,wordpress',
'paste_as_text' => true,
'paste_auto_cleanup_on_paste' => true,
'paste_remove_spans' => true,
'paste_remove_styles' => true,
'paste_remove_styles_if_webkit' => true,
'paste_strip_class_attributes' => true,
'toolbar1' => 'bold,italic,|,bullist,numlist,|,link,unlink,|,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
'toolbar4' => ''
),
) ;
wp_editor( isset( $field['value'] ) ? wp_kses_post( $field['value'] ) : '', $key, $editor );
}
//uses
//wp_editor( array( 'name' => 'editor_name', 'value' => 'pre-field-value' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment