Output post for second wordpress editor -
i added new editor pages , posts admin area wordpress 3.3 new feature
add_action( 'edit_page_form', 'my_second_editor' ); function my_second_editor() { // , set $content somehow... wp_editor( $content, 'mysecondeditor' ); }
my question how output enter in second editor on website/page? need make custom loop? codex not helpful unfortunately.
thanks
you'll need get_post_meta()
, use like:
echo get_post_meta(get_the_id(), 'mysecondeditor');
read more: http://codex.wordpress.org/function_reference/get_post_meta
to save data entered in second editor you'll need code in functions.php
file:
add_action( 'save_post', 'save_post', 10, 2 ); function save_post( $post_id, $post ) { if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id; update_post_meta( $post_id, 'mysecondeditor', stripslashes( $_post['mysecondeditor'] ) ); }
so after he's full code second editor:
wp_editor( get_post_meta(get_the_id(), 'mysecondeditor', true), 'mysecondeditor' );
the true
above makes sure single variable returned , not array can use right away.
Comments
Post a Comment