Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to use wp_editor(); (custom editor)

I've tried several methods but I am lost and I can't get it to save the post and retrieve the content in template

How to edit posts with the new wp_editor api?

also

add_action( 'edit_page_form', 'my_second_editor' );
function my_second_editor() {
    // get and set $content somehow...
    wp_editor( $content, 'my_second_editor' );
}

Looking for a simple solution which allow me to post the content and display in a same manner as the_content(); would with default editor...

any ideas?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You would need to add a metabox and then add the wp_editor as a field. You'll then need to process/save the meta data before you ever get to the part where display the data.

I just did this this morning with the Types plugin, which is about the easiest thing that I've found. (Advanced Custom Fields and Metabox are also good options)

Or to code your metabox from scratch you could use the code from this answer: Post custom metabox textarea using wp_editor

The trick I use to format it properly on the output is adding the following to function.php:

/*
 * Recreate the default filters on the_content
 * this will make it much easier to output the meta content with proper/expected formatting
*/
add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );

Then where ever you need to display the meta content call

if( $meta = get_post_meta( get_the_ID(), 'ID-of-your-meta-field', true ) ) : 
    echo apply_filters('meta_content', $meta );
share|improve this answer
    
I've read that method is buggy? –  MonteCristo Nov 28 '12 at 17:00
    
Which method are you referring to? –  helgatheviking Nov 28 '12 at 17:05
    
Metabox with WYSIWYG editor? –  MonteCristo Nov 28 '12 at 17:34
    
It is only buggy in that you can't drag the metabox around because TinyMCE will break until you refresh the page. Otherwise it works just fine. –  helgatheviking Nov 28 '12 at 17:40
    
@MonteCristo Did you get a chance to try this? –  helgatheviking Dec 8 '12 at 13:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.