kaniosrn-j
2/15/2018 - 3:10 PM

Callback function to filter the MCE settings

Apply formatting in Wysywig

<?php



// Callback function to filter the MCE settings
function mce_before_init_insert_formats( $init_array ) {
	$style_formats = array(
		array(
			'title'   => '.icon-twitter',
			'inline'  => 'span',
			'classes' => 'icon-twitter',
			'wrapper' => false,
		),
		array(
		'title'   => '.icon-facebook',
			'inline'  => 'span',
			'classes' => 'icon-facbook',
			'wrapper' => false,
    ),
    array(
    'title'   => '.icon-instagram',
    'inline'  => 'span',
    'classes' => 'icon-instagram',
    'wrapper' => false,
		)
	);

	$init_array['style_formats'] = json_encode( $style_formats );
	return $init_array;
}
add_filter( 'tiny_mce_before_init', __NAMESPACE__ . '\\mce_before_init_insert_formats' );