Created
August 17, 2016 21:10
-
-
Save Ravenna/20347fb4d5e321ab70cdc3b1d06c8039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CUSTOMIZE TinyMCE | |
| function my_mce_buttons_2( $buttons ) { | |
| array_unshift( $buttons, 'styleselect' ); | |
| return $buttons; | |
| } | |
| // Register our callback to the appropriate filter | |
| add_filter('mce_buttons_2', 'my_mce_buttons_2'); | |
| function my_theme_add_editor_styles() { | |
| add_editor_style( '/assets/css/custom-editor-style.css' ); | |
| } | |
| add_action( 'after_setup_theme', 'my_theme_add_editor_styles' ); | |
| function my_mce_before_init_insert_formats( $init_array ) { | |
| $style_formats = array( | |
| // Each array child is a format with it's own settings | |
| array( | |
| 'title' => 'Blue Text', | |
| 'block' => 'span', | |
| 'classes' => 'blue', | |
| 'wrapper' => true, | |
| ), | |
| array( | |
| 'title' => 'Leader Title', | |
| 'block' => 'p', | |
| 'classes' => 'lead', | |
| 'wrapper' => false, | |
| ), | |
| array( | |
| 'title' => 'h2.5', | |
| 'block' => 'h1', | |
| 'classes' => 'h2-5', | |
| 'wrapper' => false, | |
| ), | |
| ); | |
| $init_array['style_formats'] = json_encode( $style_formats ); | |
| return $init_array; | |
| } | |
| add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment