您可以使用项目键对样式进行分组-您也可以嵌套多次!
/* TINY MCE FORMATE */
function my_mce_before_init_insert_formats( $init_array ) {
$style_formats = array(
array(
\'title\' => \'Buttons\',
\'items\' => array(
array(
\'title\' => \'Green\',
\'selector\' => \'a\',
\'classes\' => \'btn--green\'
)
array(
\'title\' => \'Blue Button\',
\'selector\' => \'a\',
\'classes\' => \'btn--blue\'
)
),
),
array(
\'title\' => \'Download\',
\'items\' => array(
array(
\'title\' => \'Style 1\',
\'selector\' => \'a\',
\'classes\' => \'download-style-1\'
),
array(
\'title\' => \'Style 2\',
\'selector\' => \'a\',
\'classes\' => \'download-style-2\'
)
)
)
);
$init_array[\'style_formats\'] = json_encode( $style_formats );
return $init_array;
}
add_filter( \'tiny_mce_before_init\', \'my_mce_before_init_insert_formats\' );