Skip to content

Instantly share code, notes, and snippets.

@icreatesolutions
Created January 12, 2016 02:30
Show Gist options
  • Save icreatesolutions/831731dfb0e74bd31f2c to your computer and use it in GitHub Desktop.
Save icreatesolutions/831731dfb0e74bd31f2c to your computer and use it in GitHub Desktop.
TinyMCE Custom Formats in WordPRess
<?php
add_filter( 'tiny_mce_before_init', 'icreate__custom_tinymce_formats' );
function icreate__custom_tinymce_formats( $init_array ) {
// Define the style_formats array
$style_formats = array(
array(
'title' => '.blockquote-alt',
'block' => 'blockquote',
'classes' => 'blockquote-alt',
'wrapper' => true,
),
);
// Insert the array, JSON ENCODED, into 'style_formats'
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment