Quicktags on all textarea.. Not working on plugin?

I want to put a couple of quicktags/buttons on a textarea which is outputted by a plugin called user submitted posts. I have given this textarea an unique id and read this on the Quicktags documentation:

  • 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.

Than, I put this in my 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
?php } ?

The problem: nothing shows up.

PS: I already looked here: Use quicktags toolbar on any textarea

Can someone make a suggestion?

Topic quicktag buttons input tags Wordpress

Category Web


There is no possibility to make it work with a different plugin. Solution: use Javascript like here


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 = new QTags( { 'id': 'my_editor', 'buttons': 'strong,em,link' } );
QTags.addButton( 'my_button', 'my button', '<br />' );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.