Skip to content

Instantly share code, notes, and snippets.

@dmtintner
Created June 19, 2012 15:03
Show Gist options
  • Save dmtintner/2954674 to your computer and use it in GitHub Desktop.
Save dmtintner/2954674 to your computer and use it in GitHub Desktop.
WPAlchemy Multiple Wordpress TinyMCE editors using wp_editor
<p>
<label>Publications</label>
<?php
$mb->the_field('publications');
$val = html_entity_decode($mb->get_the_value());
$id = $mb->get_the_name();
$settings = array(
'textarea_rows' => 6,
'quicktags' => array(
'buttons' => 'em,strong,link',
),
'quicktags' => true,
'tinymce' => true
);
wp_editor($val, $id, $settings);
?>
<span>Enter in a list of the publications</span>
</p>
// Adds WPAlchemy MetaBox PHP Class to allow easy creation of metaboxes in WP admin
include_once 'metaboxes/setup.php';
include_once 'metaboxes/simple-spec.php';
/*******************************************************/
/* TinyMCE editor changes */
/*******************************************************/
// function to add customizations to TinyMCE
function __my_tiny_mce( $config )
{
$config['theme_advanced_path'] = false; // removes path info at the bottom of TinyMCE editors
return $config;
}
add_filter('tiny_mce_before_init', '__my_tiny_mce');
// functions to prevent wordpress from "cleaning up" the HTML output in TinyMCE
//recreate the default filters on the_content
add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
//use my override wpautop
if(function_exists('override_wpautop')){
add_filter( 'meta_content', 'override_wpautop' );
} else {
add_filter( 'meta_content', 'wpautop' );
}
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );
<?php echo apply_filters('meta_content',html_entity_decode($simple_mb->get_the_value('publications'))); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment