How to make “formats” dropdown styles apply to only the selected text?
-
How can I make the format styles dropdown in the classic editor apply to ONLY the selected text? Right now it is applying to the nearest line break from the selected text, I don’t like that.
Here is the code in my functions.php file:
function add_style_select_buttons( $buttons ) { array_unshift( $buttons, 'styleselect' ); return $buttons; } add_filter( 'mce_buttons_2', 'add_style_select_buttons' ); function my_custom_styles( $init_array ) { $style_formats = array( array( 'title' => 'Fancy Words', 'block' => 'div', 'classes' => 'fancywords', 'wrapper' => true, ) ); $init_array['style_formats'] = json_encode( $style_formats ); return $init_array; } add_filter( 'tiny_mce_before_init', 'my_custom_styles' );
The text editor wraps correctly with their buttons, why not the visual editor with it’s dropdown styles?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to make “formats” dropdown styles apply to only the selected text?’ is closed to new replies.