Using Tiny_MCE in wordpress 3.2+

Description on how to implement tiny_mce and get it to output like a post for Wordpress 3.2

So I have been working on a portfolio theme for my new wordpress driven art site. I wanted to include a tiny_mce editor in the plugin like portfolio section to allow for html text with line spaces treated as intended. However, at first the issues were that there was no consistency in application over the various versions of wordpress.

Then after that there was the issue that the output on the pages was not including the line breaks as it does in posts. I wanted to avoid having to hard code line breaks and paragraphs so I did some searching. In the end it was incredibly simple for wordpress 3.2 +.

Here is the PHP code you place instead of the textarea tag:

wp_editor( $content, $tagid, $settings =
array(
'wpautop'=> true,
'media_buttons' => true,
'textarea_rows' => '15',
'tabindex' => '',
'editor_class' => 'tumble',
'tinymce' => true,
'quicktags' => true,
'theme' => 'advanced',
'remove_linebreaks' => false,
'teeny' => false
) );

To properly call the content you must use a filter to treat it like a post entry so as to maintain the line breaks.

Calling the Content with PHP

echo apply_filters('the_content',$content );

About Aaron Bocanegra

Aaron Bocanegra is the owner of Whatartist - an Interaction Design, Photography and Video studio. He received his BFA in Fine Art Photography at the Rochester Institute of Technology and his MFA in Graduate Art Studies at the Art Center College of Design. He is interested in flowing between aesthetic and technology to solve creative problems and design complex systems.