【发布时间】:2011-02-02 10:40:45
【问题描述】:
有人知道从页面编辑屏幕中删除主编辑器的方法吗?不仅仅是css。我在 tinymce 中添加了一些其他元框,它们与主框发生碰撞。
我有一个类可以从编辑屏幕中删除其他元框,但我无法以这种方式摆脱主编辑器。我尝试将 'divpostrich' 和 'divpost' 添加到类中的数组中(但没有运气):
class removeMetas{
public function __construct(){
add_action('do_meta_boxes', array($this, 'removeMetaBoxes'), 10, 3);
}
public function removeMetaBoxes($type, $context, $post){
/**
* usages
* remove_meta_box($id, $page, $context)
* add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default')
*/
$boxes = array( 'slugdiv', 'postexcerpt', 'passworddiv', 'categorydiv',
'tagsdiv', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv',
'authordiv', 'postcustom');
foreach ($boxes as $box){
foreach (array('link', 'post', 'page') as $page){
foreach (array('normal', 'advanced', 'side') as $context){
remove_meta_box($box, $type, $context);
}
}
}
}
}
$removeMetas = new removeMetas();
我还尝试使用 jquery 删除“divpostrich”。但无法弄清楚将js放在哪里才能工作。当我使用 firebug 在浏览器中删除“postdivrich”时 - 我剩余的 tinymce 字段工作正常。
有什么想法吗?
【问题讨论】:
标签: php jquery wordpress wordpress-theming