reading the quicktags.dev.js i see in the comments
* Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties:
* settings = {
* id : 'my_id', the HTML ID of the textarea, required
* buttons: '' Comma separated list of the names of the default buttons to show. Optional.
* Current list of default button names: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
* }
*
* The settings can also be a string quicktags_id.
*
* quicktags_id string The ID of the textarea that will be the editor canvas
* buttons string Comma separated list of the default buttons names that will be shown in that instance.
which seems like i should be able to call the javascript functions quicktags(), pass it at least the ID of a text area and I should get the quicktags editor created just before any textarea. (i’m working in a metabox).
however, if i put the following in my code:
try { quicktags( '_repeating_textareas_meta[repeating_textareas][0][textarea]'); } catch(e){}
which I essentially copied from bit of javascript that WP has it in the source and added my metabox’s ID.
it prints out the div where the quicktags toolbar should be but doesn’t make any buttons
<div id="qt__repeating_textareas_meta[repeating_textareas][0][textarea]_toolbar" class="quicktags-toolbar"></div>
console.log doesn’t show any errors. and i swear that this time i have undone all potential tampering to source code.
EDIT:
i’ve isolated the problem down to where the script appears in the source… using Fred Rocha’s function works great (and much like i anticipated) if it runs on the admin_print_footer_scripts but not on after_wp_tiny_mce… it results in the same empty toolbar i was getting.
other parts of my jquery plugin need to run after the tinymce settings are initialized (since i’m straight borrowing the existing settings), so why would it work properly on the one hook but not on a later hook?
I have stumbled into this very same issue, and got the quicktags to work.
Here’s the code to add to functions.php:
This is the basic code that should get quicktags to work.
In case you want to go through all the (Verve) Metaboxes, and assign a toolbar, the following code could do the trick:
Also, in order to keep the line breaks on your front end, make sure you use “the_content” filter when outputting the textarea content, as so:
The priority with which the my_admin_print_footer_scripts method was being called was the blocking issue.
Good luck!
I have been able to display Alex King’s quicktag script in my comment form.
I have documented the steps and code here.
Just Download and enqueue the Alex Kings QuickTag Script. 🙂