functional quicktag

Simple example that will add a Quicktag button that calls a Javascript function when it is clicked… <?PHP function _add_my_quicktags(){ ?> <script type=”text/javascript”> QTags.addButton( ‘alert’, ‘Alert Button’, simple_alert ); function simple_alert() { alert(‘hello, example callback function’); } </script> <?php } add_action(‘admin_print_footer_scripts’, ‘_add_my_quicktags’); ?> UPDATE…. Adding a Callback function that utilizes the passed in variables… // … Read more

Custom quicktags not working after WordPress 6.0

I had the same problem. I fixed it by using the ep_enqueue_script aproach shown here: https://codex.wordpress.org/Quicktags_API listed under “A more modern example”. It’s the same thing that Tom mentions. Instead of using ‘admin_print_fotter_scripts’ to write an inline script on the page, the example shows putting the Qtags javascript in a separate JS file, and loading … Read more

Quicktags on all textarea.. Not working on plugin?

it you’re not seeing the buttons, try to call QTags._buttonsInit(); right after you call the quicktags( settings ); function. quicktags(settings); QTags._buttonsInit(); Following also works for me qt_editor = new QTags( { ‘id’: ‘my_editor’, ‘buttons’: ‘strong,em,link’ } ); QTags._buttonsInit(); Also, it seems that adding a button via QTags.addButton() function also makes your toolbar to display qt_editor … Read more

Remove quicktag buttons but not Visual / Text editor and tabs

As you noted, setting quicktags to false removes the “visual” and “text” tabs. So, to leave the tabs you need to set quicktags to true and remove the buttons: $settings = array( ‘quicktags’ => array( ‘buttons’ => ‘,’ ) ); wp_editor($input, ‘editor_name’, $settings); To have this in all quicktags instances you can use quicktags_settings filter: … Read more

Use quicktags toolbar on any textarea

I have stumbled into this very same issue, and got the quicktags to work. Here’s the code to add to functions.php: <?php add_action(‘admin_print_footer_scripts’,’my_admin_print_footer_scripts’); function my_admin_print_footer_scripts() { ?> <script type=”text/javascript”>/* <![CDATA[ */ var id = “myID”; // this is your metabox’s textarea id settings = { id : id, buttons: ‘strong,em,link’ } quicktags(settings); /* ]]> */</script> … Read more

Customizing HTML Editor Quicktags button to open a dialog for choosing insert options

According to the Codex, you can’t do this directly through the API. However, you can do it by using your own quicktags.js file as shown below. function sample_load_admin_scripts() { if ( is_admin() ) { wp_deregister_script(‘quicktags’); wp_register_script(‘quicktags’, (“/path/to/your/quicktags.js”), false, ”, true); } } if (is_admin()) { add_action(‘init’, sample_load_admin_scripts); } Then just add Javascript to do your … Read more