Skip to:
Content
Pages
Categories
Search
Top
Bottom

TinyMCe toolbar customisation


  • rinh
    Participant

    @rinh

    Hi,
    I’m trying to customise the toolbar in TinyMCE.

    Initially I just enabled the advanced one:

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['teeny'] = false;
        $args['quicktags'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    I thought of adding a button for underline and it led to trying to get only what I needed in one toolbar:

    function bbp_enable_visual_editor( $args = array() ) {
      
        $args['tinymce'] = array('toolbar1' => 'formatselect, bold, italic, underline, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, strikethrough, forecolor, outdent, indent, undo, redo');
        $args['quicktags'] = false;
        $args['teeny'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    This is causing it to repeat some things in toolbar 2 (as well as the ability to toggle toolbar 2 on and off). I tried adding toolbar 2 to the code above, but then it goes back to default. I could stop there though and just add underline and the tools that’s in toolbar 1 by default, but I’m curious if I can customise things further.

    To my question:
    Is there a way to add everything in one toolbar and then disable toolbar 2?
    Or is there a way to get the toogle for toolbar 2 back when I’ve customised toolbar 1?

    I also tried enabling teeny which would’ve worked best, but then I lose the forecolor toolbar box so I’d need a way to add it back.

    Thanks in advance

Viewing 1 replies (of 1 total)

  • rinh
    Participant

    @rinh

    Sorry for double post, but I got the toggle button back by adding wp_adv, as well as the image button. Full code below if anyone needs it too

    function bbp_enable_visual_editor( $args = array() ) {
      
        $args['tinymce'] = array('toolbar1' => 'formatselect, bold, italic, underline, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, image, wp_adv');
        $args['quicktags'] = false;
        $args['teeny'] = false;
    
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    For toolbar 2 I hid the unwanted buttons with CSS. I’m happy with the results 🙂 Still curious though if toolbar 2 can be customised, but it’s nothing necessary.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar