Skip to content

Instantly share code, notes, and snippets.

@trepmal
Created October 28, 2011 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save trepmal/1323851 to your computer and use it in GitHub Desktop.
Save trepmal/1323851 to your computer and use it in GitHub Desktop.
Quicktags API Test
<?php
/*
Plugin Name: Quicktags API Test
Description: Testing a few different kinds of Quicktags buttons
Author: Kailey Lampert
Author URI: http://kaileylampert.com/
*/
add_action( 'admin_print_footer_scripts', 'a_few_different_quicktags_buttons', 100 );
function a_few_different_quicktags_buttons() {
?>
<script type="text/javascript">
QTags.addButton( 'k_01', 'test 1', prompt_user );
function prompt_user(e, c, ed) {
prmt = prompt('Enter something');
if ( prmt === null ) return;
rtrn = '[short]' + prmt + '[/short]';
this.tagStart = rtrn;
QTags.TagButton.prototype.callback.call(this, e, c, ed);
}
QTags.addButton( 'k_02', 'test 2', simple_alert );
function simple_alert(e, c, ed) {
alert('hello');
}
QTags.addButton( 'k_03', 'test 3', '[selfclosing/]');
QTags.addButton( 'k_04', 'test 4', '[bookend]', '[/bookend]' );
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment