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

Add QuickTag in bbpress replies

SOLVED! I just put anther add_action to insert the javascript in the rest of the theme (and for bbpress too): add_action( ‘wp_print_footer_scripts’, ‘generico_quicktags’ ); The quicktags check in function already prevents wordpress to put the javascript in unwanted places!

Callback function quicktags that uses variable in start tag

Managed to find out how: function callback_wrap(e, c, ed) { var course = getSelectedText(“_lesson_course”); var module_info = jQuery(“#title”).val(); var module_nr = module_info.match( /\d+/g ); var start = ed.canvas.selectionStart; var end = ed.canvas.selectionEnd; var content = jQuery(“#content”).val(); console.log(start); console.log(end); console.log(ed); var selected = content.slice(start, end); var string = ‘<div class=”moudle-area”>’+selected+'<p>[Tweet “I just completed Module ‘+module_nr+’ of … Read more

quicktag breaking FancyBox plugin on my blog’s front page

Your images aren’t being encapsulated by the hyperlink markup, so unless you’re using additional calls, Fancybox won’t know which hyperlinks/images to Fancybox. You’ll either need to fix this in the template loop that your homepage uses, or add some hacky additional call like: jQuery(‘.post .imgpost’).on(‘click’, function($) { $.fancybox(); });

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’;