Skip to content

Instantly share code, notes, and snippets.

@mi-ca
Last active August 16, 2017 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mi-ca/e4e61727f6ca40837486045466acead9 to your computer and use it in GitHub Desktop.
Save mi-ca/e4e61727f6ca40837486045466acead9 to your computer and use it in GitHub Desktop.
My favorite tinymce ;)
<?php
function my_format_TinyMCE( $in ) {
$in['block_formats'] = "Paragraph=p; Heading 3=h3; Heading 4=h4";
$in['toolbar1'] = 'pastetext,bold,blockquote,italic,bullist,numlist,link,wp_adv';
$in['toolbar2'] = 'formatselect,italic,strikethrough,charmap,wp_more,unlink,removeformat,outdent,indent,undo,redo,wp_help';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
add_filter('tiny_mce_before_init', 'tiny_mce_remove_unused_formats' );
/*
* Modify TinyMCE editor to remove H1.
*/
function tiny_mce_remove_unused_formats($init) {
// Add block format elements you want to show in dropdown
$init['block_formats'] = 'Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Address=address;';
return $init;
}
add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars' );
function my_toolbars( $toolbars )
{
// Uncomment to view format of $toolbars
/*
echo '< pre >';
print_r($toolbars);
echo '< /pre >';
die;
*/
// Add a new toolbar called "Very Simple"
// - this toolbar has only 1 row of buttons
$toolbars['mica Cleaned' ] = array();
$toolbars['mica Cleaned' ][1] = array('pastetext' , 'bold' ,'blockquote', 'italic','bullist','numlist','link','wp_adv' );
$toolbars['mica Cleaned' ][2] = array( 'formatselect','italic','strikethrough','charmap','wp_more','unlink','removeformat','outdent','indent','undo','redo','wp_help' );
// return $toolbars - IMPORTANT!
return $toolbars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment