// ------------------------------------------------
// Add Word Count Plugin to TinyMCE Instances
// ------------------------------------------------
// Download plugin from TinyMCE website
// Add wordcount plugin to TinyMCE for all instances.
// add_filter('mce_external_plugins', 'pd_register_tinymce_plugins');
function pd_register_tinymce_plugins() {
$plugins = array('wordcount'); // Add any more plugins you want to load here
$plugins_array = array();
// Build the response - the key is the plugin name, value is the URL to the plugin JS
foreach ($plugins as $plugin ) {
$plugins_array[$plugin] = get_template_directory_uri() . '/js/tinymce/plugins/wordcount/plugin.min.js';
}
return $plugins_array;
}
// ----------------------------------------------------
// Customize available block formats (headings, etc)
// ----------------------------------------------------
function wb_remove_h1_from_editor( $init ) {
// Add block format elements you want to show in dropdown
$init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;';
return $init;
}
add_filter( 'tiny_mce_before_init', 'wb_remove_h1_from_editor' );