ThemeShaper Forums » Thematic

[closed]

Removing default classes from TinyMCE?

(3 posts)
  • Started 9 years ago by manlikemalcolm
  • Latest reply from manlikemalcolm
  • This topic is resolved
  1. Howdy everyone, I have figured out how to add custom classes to the Tiny MCE editor using the Advanced Tiny MCE editor, but I cannot figure out how to remove the following default classes fro the styles drop-down menu

    alignleft
    aligncenter
    alignright
    wp-caption
    wp-caption-dd
    wpgallery

    Thanks for your help!

    Posted 9 years ago #
  2. Ok , So with a little research I have decided to stop using the Advanced Tiny MCE editor and have written functions to edit the available buttons/options on the TinyMCE editor.

    //Specify formatting options visible in the format dropdown
    function childtheme_tiny_mce_before_init_formats( $init_array ) {
    $init_array['theme_advanced_blockformats'] = 'p, h2,h3,h4,h5,h6';
    return $init_array;
    }
    add_filter( 'tiny_mce_before_init', 'childtheme_tiny_mce_before_init_formats' );

    //Specify Styles visible in Styles dropdown (styleselect)
    function childtheme_tiny_mce_before_init( $init_array ) {
    $init_array['theme_advanced_styles'] = "Object Label=objectLabel";
    return $init_array;
    }
    add_filter( 'tiny_mce_before_init', 'childtheme_tiny_mce_before_init' );

    //Customize buttons in 1st row
    function childtheme_mce_btns1($orig) {
    return array('formatselect', 'styleselect', '|' ,'bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', '|', 'link', 'unlink', '|', 'blockquote', 'sub', 'sup', 'charmap');
    }
    add_filter( 'mce_buttons', 'childtheme_mce_btns1', 111 );

    //Customize buttons in 2nd row //I can do this with advanced
    function childtheme_mce_btns2($orig) {
    return array( 'removeformat', '|', 'undo', 'redo', 'pagebreak');
    }
    add_filter( 'mce_buttons_2', 'childtheme_mce_btns2', 222 );

    In this last code example, for some reason "pagebreak" does not work. Is this because it is a plugin? I think I am missing a crucial concept here. Any help world be greatly appreciated.

    Thanks, Malcolm

    Posted 9 years ago #
  3. The last code example should use "wp_more" instead of "pagebreak"

    //Customize buttons in 2nd row //I can do this with advanced
    function childtheme_mce_btns2($orig) {
    return array( 'removeformat', '|', 'undo', 'redo', 'wp_more');
    }
    add_filter( 'mce_buttons_2', 'childtheme_mce_btns2', 222 );

    I could not find any documentation for this but saw it in the list of buttons in a tinyMCE advancd plugin file.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.