Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Forked from bicyclista/wpalchemy wp_editor()
Created February 15, 2012 18:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save helgatheviking/1838037 to your computer and use it in GitHub Desktop.
Save helgatheviking/1838037 to your computer and use it in GitHub Desktop.
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 );
?>
</div>
<?php
// 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
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment