您的第一个筛选器不正确。”styleselect\'在tinyMCE上提供并生成下拉列表。你不能添加这样的信息。
下面是要做的事情。
Nice way:
首先,创建一个名为“custom\\u wp\\u admin\\u editor\\u tinymce”的单独文件。php”(或任何其他)。函数内部。php,请将文件包含在创建上一个函数的正确路径中。
// Add the heading dropdown (x6) and add the format dropdown
include_once(TEMPLATEPATH.\'/Path to you doc/custom_wp_admin_editor_tinymce.php\');
这是您的“custom\\u wp\\u admin\\u editor\\u tinymce”模板。
<?php
// Add the heading dropdown (x6) and add the format dropdown
function enable_style_dropdown($buttons) {
$buttons[] = \'styleselect\';
return $buttons;
}
add_filter("mce_buttons_2", "enable_style_dropdown");
function myformatTinyMCE( $in ) {
$in[\'block_formats\'] = \'Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6\';
$style_formats = array (
array( \'title\' => \'bold\', \'block\' => \'p\', \'classes\' => \'bold\' ),
array( \'title\' => \'italic\', \'block\' => \'p\', \'classes\' => \'italic\' ),
array( \'title\' => \'link\', \'block\' => \'p\', \'classes\' => \'link\' ),
array( \'title\' => \'unlink\', \'block\' => \'p\', \'classes\' => \'unlink\' ),
array( \'title\' => \'bullist\', \'block\' => \'p\', \'classes\' => \'bullist\' ),
array( \'title\' => \'numlist\', \'block\' => \'p\', \'classes\' => \'numlist\' ),
array( \'title\' => \'table\', \'block\' => \'p\', \'classes\' => \'table\' ),
array( \'title\' => \'anchor\', \'block\' => \'p\', \'classes\' => \'anchor\' )
);
$in[\'style_formats\'] = json_encode( $style_formats );
$in[\'style_formats_merge\'] = false;
$in[\'wordpress_adv_hidden\'] = false;
return $in;
}
add_filter( \'tiny_mce_before_init\', \'myformatTinyMCE\' );
?>
Dirty way:
直接在函数中通过前面的代码。php