Skip to content

Instantly share code, notes, and snippets.

Forked from bicyclista/wpalchemy wp_editor()
Created February 15, 2012 18:35
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
wpalchemy metaboxes VS. wordpress wp_editor()
<div class="my_meta_control">
<?php $mb->the_field('test_editor');
$settings = array(
'textarea_rows' => '10',
'media_buttons' => 'false',
'tabindex' =>2
$val = html_entity_decode($mb->get_the_value());
$id = $mb->get_the_name();
wp_editor($val, $id , $settings );
// Define a constant for the WPAlchemy directory uri
define('WPALCHEMY', get_stylesheet_directory_uri() . '/WPAlchemy');
// Require WP_Alchemy Meta Box Class
require_once( dirname(__FILE__) . '/WPAlchemy/MetaBox.php');
// include css to help style our custom meta boxes
// this should be a global stylesheet used by all similar meta boxes
if (is_admin()) wp_enqueue_style('custom_meta_css', WPALCHEMY .'/meta.css');
$editor_metabox = new WPAlchemy_MetaBox(array
'id' => '_editor_meta', // underscore prefix hides fields from the custom fields area
'title' => _('Sample WP_Editor'),
'template' => dirname(__FILE__) . '/WPAlchemy/editor_meta.php'
//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
add_filter( 'meta_content', 'override_wpautop' );
} else {
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment