Support » Plugin: CKEditor for WordPress » Adding Custom Plugins / Buttons to CKEditor 4.0 WordPress 3.5 Toolbar

Viewing 5 replies - 1 through 5 (of 5 total)
  • @own3mall Hey, I think what you mentioned are dealing with how to create ckeditor plugins or add a plugin in the ckeditor way. But to add buttons to CKEditor For WordPress plugin’s toolbar, you need to use the WordPress way.

    There are two filters you can use to load your custom ckeditor plugin and button.
    ckeditor_external_plugins – load custom plugins
    ckeditor_buttons – load custom buttons

    Use them together you can add your plugin, here is an example. But beware that this only adds buttons to the editor in back end. It can’t change anything for comment area editor. To modify the comment editor, it’s better to use ckeditor.config.js in my opinion.

    add_action('init', 'custom_ckeditor_interface');
    function custom_ckeditor_interface(){
    	add_filter( 'ckeditor_external_plugins', 'register_custom_ckeditor_plugins' );
    	add_filter( 'ckeditor_buttons', 'register_custom_ckeditor_buttons' );
    }
    //Load external ckeditor plugins
    function register_custom_ckeditor_plugins( $plugins ){
    	$plugins['your_plugin_name_1'] = 'your_plugin_uri_1';
    	$plugins['your_plugin_name_2'] = 'your_plugin_uri_2';
    	return $plugins;
    }
    //Add more buttons
    function register_custom_ckeditor_buttons( $buttons ){
    	$buttons[] = array('button_1');
    	$buttons[] = array('button_2');
    	return $buttons;
    }

    The plugin name and button name are defined in your ckeditor plugin scripts(eg. plugin.js)

    Hey Solagirl,

    I tried a variant of your solution, and it didn’t work. My buttons didn’t show up.

    Here’s what I have:

    In ckeditor_wordpress.php:

    [Large code excerpt removed by moderator per forum rules. Please use the pastebin for all large code excerpts. It works better anyway.]

    The buttons don’t show up. Any idea why? This is really frustrating!

    Forget my last post.

    I actually noticed that using the HTMLButtons plugin works fine for the comments, but I need this button in the full post editor.

    http://pastebin.com/p8KsE3NM

    So again, the basic works fine, but how do I add button1, button2, button3 to the full editor?

    I finally got it to work. I followed this blog:

    Adding Custom Buttons and Plugins to WordPress’ Instance of CKEditor

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding Custom Plugins / Buttons to CKEditor 4.0 WordPress 3.5 Toolbar’ is closed to new replies.