Created
January 13, 2015 03:39
-
-
Save raewrites/1a03f303d57d9186f553 to your computer and use it in GitHub Desktop.
Registering Custom Styles
This file contains 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
// Callback function to filter the MCE settings | |
function my_mce_before_init_insert_formats( $init_array ) { | |
// Define the style_formats array | |
$style_formats = array( | |
// Each array child is a format with it's own settings | |
array( | |
'title' => '.translation', | |
'block' => 'blockquote', | |
'classes' => 'translation', | |
'wrapper' => true, | |
), | |
array( | |
'title' => '⇠.rtl', | |
'block' => 'blockquote', | |
'classes' => 'rtl', | |
'wrapper' => true, | |
), | |
array( | |
'title' => '.ltr⇢', | |
'block' => 'blockquote', | |
'classes' => 'ltr', | |
'wrapper' => true, | |
), | |
); | |
// Insert the array, JSON ENCODED, into 'style_formats' | |
$init_array['style_formats'] = json_encode( $style_formats ); | |
return $init_array; | |
} | |
// Attach callback to 'tiny_mce_before_init' | |
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