TinyMCE – Show Advanced Options (2nd Row) By Default

So I’ve customized my tinyMCE a bit to add some buttons and rearrange some things:

function myformatTinyMCE($in)
{
    $in['theme_advanced_buttons1']='bold,italic,underline,bullist,numlist,hr,blockquote,link,unlink,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent';
    $in['theme_advanced_buttons2']='formatselect,pastetext,pasteword,charmap,undo,redo';
    return $in; 
}
add_filter('tiny_mce_before_init', 'myformatTinyMCE' );

I thought by not adding wp_adv to the end of the first button list, the 2nd row would show by default but this is not the case – I just lose the 2nd row entirely. I want to show the 2nd row – always, without pressing or displaying the wp_adv button.

Read More

How can I show a 2nd row in my TinyMCE by Default?

Related posts

1 comment

  1. If you inspect the value of $in you should get something like:

    Array
    (
        [mode] => exact
        [width] => 100%
        [theme] => advanced
        [skin] => wp_theme
        [language] => en
        [theme_advanced_toolbar_location] => top
        [theme_advanced_toolbar_align] => left
        [theme_advanced_statusbar_location] => bottom
        [theme_advanced_resizing] => 1
        [theme_advanced_resize_horizontal] => 
        [dialog_type] => modal
        [formats] => {
                            alignleft : [
                                {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
                                {selector : 'img,table', classes : 'alignleft'}
                            ],
                            aligncenter : [
                                {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
                                {selector : 'img,table', classes : 'aligncenter'}
                            ],
                            alignright : [
                                {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
                                {selector : 'img,table', classes : 'alignright'}
                            ],
                            strikethrough : {inline : 'del'}
                        }
        [relative_urls] => 
        [remove_script_host] => 
        [convert_urls] => 
        [remove_linebreaks] => 1
        [gecko_spellcheck] => 1
        [fix_list_elements] => 1
        [keep_styles] => 
        [entities] => 38,amp,60,lt,62,gt
        [accessibility_focus] => 1
        [media_strict] => 
        [paste_remove_styles] => 1
        [paste_remove_spans] => 1
        [paste_strip_class_attributes] => all
        [paste_text_use_dialog] => 1
        [webkit_fake_resize] => 
        [preview_styles] => font-family font-weight text-decoration text-transform
        [schema] => html5
        [wpeditimage_disable_captions] => 
        [wp_fullscreen_content_css] => http://example.com/wp-includes/js/tinymce/plugins/wpfullscreen/css/wp-fullscreen.css
        [plugins] => inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen
        [content_css] => http://example.com/wp-content/themes/twentytwelve/editor-style.css,http://fonts.googleapis.com/css?family=Open+Sans:400italic%2C700italic%2C400%2C700&subset=latin%2Clatin-ext
        [elements] => content
        [wpautop] => 1
        [apply_source_formatting] => 
        [theme_advanced_buttons1] => bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv
        [theme_advanced_buttons2] => formatselect,underline,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo,wp_help
        [theme_advanced_buttons3] => 
        [theme_advanced_buttons4] => 
        [tabfocus_elements] => insert-media-button,save-post
        [body_class] => content post-type-post post-status-publish post-format-standard
        [theme_advanced_resizing_use_cookie] => 
        [wordpress_adv_hidden] => 
    )
    

    The last item wordpress_adv_hidden gives you the possibility to hide/show the kitchen sink

    Open Kitchen Sink by default

    /**
     * Modify TinyMCE 
     *
     * @param array $in
     * @return array $in
     */
    function my_tiny_mce_before_init( $in ) {
    
        // customize the buttons
        $in['theme_advanced_buttons1'] = 'bold,italic,underline,bullist,numlist,hr,blockquote,link,unlink,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent';         
        $in['theme_advanced_buttons2'] = 'formatselect,pastetext,pasteword,charmap,undo,redo';
    
        // Debug:
        // print_r( $in );
        // exit();
    
        // Keep the "kitchen sink" open:   
        $in[ 'wordpress_adv_hidden' ] = FALSE;
    
        return $in;
    }
    add_filter( 'tiny_mce_before_init', 'my_tiny_mce_before_init' );
    

Comments are closed.