Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active December 14, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/5016952 to your computer and use it in GitHub Desktop.
Save trepmal/5016952 to your computer and use it in GitHub Desktop.
wp_editor and media tests
<?php
//Plugin Name: wp_editor Test
new wp_editor_Test();
class wp_editor_Test {
function __construct() {
add_action( 'admin_menu', array( &$this, 'menu' ) );
}
function menu() {
add_options_page( 'wp_editor Test', 'wp_editor Test', 'edit_posts', __FILE__, array( &$this, 'page' ) );
}
function page() {
?><div class="wrap">
<h2><?php _e('wp_editor Test'); ?></h2>
<?php
echo '<h3>Test 1</h3>';
$args = array(
'tinymce' => false,
'quicktags' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test1', $args );
echo '</div><br style="clear:both" />';
echo '<h3>Test 2</h3>';
$args = array(
'tinymce' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test2', $args );
echo '</div><br style="clear:both" />';
echo '<h3>Test 3</h3>';
$args = array(
'quicktags' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test3', $args );
echo '</div><br style="clear:both" />';
?>
<hr />
<p>Test 1 active: no media inserted</p>
<p>Test 2 active: media inserted</p>
<p>Test 3 active: media inserted</p>
<p>Tests 1 &amp; 2 active: media only inserted into #2</p>
<p>Tests 1 &amp; 3 active: media inserted into both</p>
<p>Tests 2 &amp; 3 active: media inserted into both</p>
<p>Tests 1, 2, &amp; 3 active: media inserted into all (sometimes quicktags &amp; tinymce weren't showing on #3. probably my fault, need to investigate...)</p>
</div><?php
}
function printer( $input ) {
echo '<pre style="width: 200px;float:left;">' . print_r( $input, true ) . '</pre>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment