Quicktag insert multiple lines

This is the format you need to follow, //double quotes require escaping var your_html = “<div class=\”one-half first\”>1st</div>\n<div class=\”one-half\”>2nd</div>\n<div class=\”clear-line\”></div>”; //single quotes do not require escpaing var your_html=”<div class=”one-half first”>1st</div>\n<div class=”one-half”>2nd</div>\n<div class=”clear-line”></div>”; QTags.addButton( ‘my_tag’, ‘Multi Line’, your_html, ” ); I’d just store my html in a var (eg. your_html) then pass that to your QTags.addButton … Read more

Remove default quicktags

You can achieve this using the quicktag_settings filter function wpse41427_remove_quicktags( $qtInit ) { $qtInit[‘buttons’] = ‘strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen’; return $qtInit; } add_filter(‘quicktags_settings’, ‘wpse41427_remove_quicktags’); The default buttons for quicktags is a comma seperated value for the buttons key: $qtInit[‘buttons’] = ‘strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen’;

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

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