解决了它。
因此,为了将默认按钮从第一行移动到第二行,我们需要钩住mce_buttons
过滤器:
function move_mce_buttons_to_top($buttons) {
$buttons[] = \'redo\';
// buttons
return $buttons;
}
add_filter(\'mce_buttons\', \'move_mce_buttons_to_top\');
然后,要将段落下拉列表添加到顶行,我们将它们添加为自定义样式。
首先,让我们将styleselect启用为mce_buttons
(顶行):
// Callback function to insert \'styleselect\' into the $buttons array
function my_mce_buttons( $buttons ) {
array_unshift( $buttons, \'styleselect\' );
return $buttons;
}
// Register our callback to the appropriate filter
add_filter(\'mce_buttons\', \'my_mce_buttons\');
然后相应地注册每个项目:
add_filter( \'tiny_mce_before_init\', \'drop_mce_before_init\' );
function drop_mce_before_init( $settings ) {
$style_formats = array(
array(
\'title\' => \'Paragraph\',
\'block\' => \'p\',
),
array(
\'title\' => \'Heading 2\',
\'block\' => \'h2\',
)
);
$settings[\'style_formats\'] = json_encode( $style_formats );
return $settings;
}
编辑:更新代码,以便与
P
标签