Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hi there!

    Does this happen if you deactivate all your plugins or use a bundled theme like Twenty Fourteen/Fifteen?

    David_G

    (@questas_admin)

    You can make your own buttons. They are not hard

    http://www.w3schools.com/bootstrap/bootstrap_ref_css_buttons.asp

    Thread Starter tien-nguyen

    (@tien-nguyen)

    @jose Castaneda

    Yes. I disabled all plugins and tried with Twenty Fourteen. Here is code in functions.php

    function wpi_post_editor_buttonhooks() {
    	// Only add hooks when the current user has permissions AND is in Rich Text editor mode
    	if ( ( current_user_can('edit_posts') || current_user_can('edit_pages') ) && get_user_option('rich_editing') ) {
    		add_filter("mce_external_plugins", "wpi_post_editor_register_tinymce_javascript");
    		add_filter('mce_buttons', 'wpi_post_editor_register_buttons');
    	}
    }
    
    function wpi_post_editor_register_buttons($buttons) {
       array_push($buttons, '|', 'slider');
       return $buttons;
    }
    
    // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
    function wpi_post_editor_register_tinymce_javascript($plugin_array) {
       $plugin_array['wpi_post_editor'] = get_template_directory_uri() . '/js/editor.js';
       return $plugin_array;
    }
    
    // init process for button control
    add_action('init', 'wpi_post_editor_buttonhooks');

    And here is the code of editor.js:

    jQuery(function($) {
    	(function() {
    		// prepare box for input content
    		tinymce.create('tinymce.plugins.Wpi_post_editor', {
    			init : function(ed, url) {
    				// Contact
    				ed.addButton('slider', {
    					title : 'Slider',
    					cmd : 'slider',
    					image : 'slider.png'
    				});
    			},
    		});
    		// Register plugin
    		tinymce.PluginManager.add( 'wpi_post_editor', tinymce.plugins.Wpi_post_editor );
    	})();
    });

    Thread Starter tien-nguyen

    (@tien-nguyen)

    I also found, we can not add shortcode with name “button”. That’s disappointed.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Can not add shortcode button with name "slider"’ is closed to new replies.