path = get_template_directory_uri() . '/lib/admin/'; // Modify the version when tinyMCE plugins are changed. } function action_admin_init() { // only hook up these filters if we're in the admin panel, and the current user has permission // to edit posts and pages if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) return; // Add only in Rich Editor mode if ( get_user_option('rich_editing') == 'true') { add_filter( 'mce_buttons', array( $this, 'filter_mce_button' ) ); add_filter( 'mce_external_plugins', array( $this, 'filter_mce_plugin' ) ); } } function filter_mce_button( $buttons ) { // add a separation before our button, here our button's id is "dd_button" array_push( $buttons, '|', 'dd_button' ); return $buttons; } function filter_mce_plugin( $plugins ) { // this plugin file will work the magic of our button $plugins['tinymce_button'] = $this->path .'tinymce.js'; return $plugins; } } $tinymce_button = new DDAddButton(); // Shortcodes function dd_checklist( $atts, $content = null ) { $content = str_replace('