Last active
August 29, 2015 14:21
-
-
Save mcmullengreg/fca018f231e1d6fa5584 to your computer and use it in GitHub Desktop.
Editor Mods for OL Reversed
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
// For CKEditor | |
// you will just add an object style to the StylesSet Object | |
CKEDITOR.stylesSet.add('cs_styles', [ | |
// Object Styles | |
{ | |
name : 'OL Reversed', | |
element : 'ol', | |
attributes : { | |
'reversed' : 'reversed' | |
} | |
} | |
]); |
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
// For TinyMCE (not within wordpress) | |
// Adjust your initialize call accordingly | |
tinymce.init({ | |
style_formats: [ | |
{ | |
title: 'Reverse OL', | |
selector: 'ol', | |
attributes: { | |
'reversed':'reversed', | |
}, | |
}, | |
] | |
)}; |
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
/* | |
This code goes in your functions.php | |
Check your themes functions file as they may already be using this. | |
*/ | |
// Add Formats Dropdown Menu To MCE | |
add_filter( 'mce_buttons', 'mce_style_button' ); | |
if ( ! function_exists( 'mce_style_button' ) ) { | |
function mce_style_button( $buttons ) { | |
array_push( $buttons, 'styleselect' ); | |
return $buttons; | |
} | |
} | |
// Adds styles to the dropdown | |
add_filter( 'tiny_mce_before_init', 'mce_before_init' ); | |
function mce_before_init( $settings ) { | |
$style_formats = array( | |
array( | |
'title' => 'Reverse OL', | |
'attributes' => array( | |
'reversed' => 'reversed', | |
), | |
'selector' => 'ol', | |
), | |
); | |
$settings['style_formats'] = json_encode( $style_formats ); | |
return $settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment