Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marventus

    (@marventus)

    Hello there.
    All buttons added by UTMCE can be removed. However, in order to remove the icons that are added by WP, you would need a filter for each one of the first 2 rows. You would need a code like this:

    /* Row 1 */
    function userf_buttons_1($buttons) {
    	$remove = array('bold','italic');
    	foreach($remove as $rem) {
    		if ( in_array($rem, $buttons) )
    			unset($buttons[array_search($rem, $buttons)]);
    	}
    	return $buttons;
    }
    add_filter("mce_buttons", "userf_buttons_1");
    
    /* Row 2 */
    function userf_buttons_2($buttons) {
    	$remove = array('formatselect','underline');
    	foreach($remove as $rem) {
    		if ( in_array($rem, $buttons) )
    			unset($buttons[array_search($rem, $buttons)]);
    	}
    	return $buttons;
    }
    add_filter("mce_buttons_2", "userf_buttons_2");

    Please note that, for each function, there is a $remove array with some buttons as an example. What you need to do is replace the values of each one with the names of the buttons you would like to remove from the editor on a per row basis.

    Here is a list of all the button handles added by WP on rows 1 and 2:
    Row 1: bold, italic, strikethrough, bullist, numlist, blockquote, justifyleft, justifycenter, justifyright, link, unlink, wp_more, spellchecker, fullscreen.
    Row 2: formatselect, underline, justifyfull, forecolor, pastetext, pasteword, removeformat, charmap, outdent, indent, undo, redo, wp_help.

    Thread Starter Spudnic

    (@spudnic072)

    Awsome! thanks ill give that a try.

    Thread Starter Spudnic

    (@spudnic072)

    That worked great, thanks!

    Is there a way to add custom buttons? Ones that are not already included with the plugin? I would like to be able to have text wrapped in <blizz></blizz> when i highlight it and click the custom button.

    I hope this is possible. I have an plugin that does this, but when using bbpress it doesn’t get added to the editor.

    Plugin Author Marventus

    (@marventus)

    Yeah, you totally can. If you already have a plugin that is compatible with tinymce, all you have to do is:
    1. Add the plugin handle to the $buttons array;
    2. Register the JS file (as an url) that the plugin requires in order to work via the mce_external_plugins hook.
    So, assuming the blizz plugin’s handle was blizz, you would go:

    function userf_add_buttons($buttons) {
        $buttons[] = 'blizz'
    }
    add_filter('mce_buttons', 'userf_add_buttons');
    
    function userf_register_buttons($plugins_array) {
        $plugins_array['blizz'] = 'url/to/main/addon/js/file.js';
        return $plugins_array;
    }
    add_filter('mce_external_plugins, 'userf_register_buttons')

    That would add your custom plugin on row 1 of the editor. If you wanted it on row 2, you would have to add the filter to mce_buttons_2:

    add_filter('mce_buttons_2', 'userf_add_buttons');

    Plugin Author Josh

    (@josh401)

    Hi spudnic072, and thanks for your support in our plugin!

    I’m going to mark this thread as resolved. Please feel free to change it in the future.

    Also, we certainly wouldn’t mind if you wanted to submit a rating and review for our plugin. You can do it from the main plugin page.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove button?’ is closed to new replies.