我已经能够在后端为非管理员禁用所有元框,但我在Facebook AWD All in one 它创建了一个小部件,所有用户在创建新帖子时都可以看到。如何禁用它?是否有某种命令适用于由插件创建的任何小部件,我可以将其添加到我的函数中。php如果我知道插件的短代码?我需要你的帮助!谢谢
http://wordpress.org/extend/plugins/facebook-awd/
我使用以下代码删除元框
######################################################################
# remove evreything from add a new post
######################################################################
if (is_admin()) :
function remove_post_meta_boxes() {
if(!current_user_can(\'administrator\')) {
remove_meta_box(\'tagsdiv-post_tag\', \'post\', \'normal\');
//remove_meta_box(\'categorydiv\', \'post\', \'normal\');
remove_meta_box(\'postimagediv\', \'post\', \'normal\');
remove_meta_box(\'authordiv\', \'post\', \'normal\');
remove_meta_box(\'postexcerpt\', \'post\', \'normal\');
remove_meta_box(\'trackbacksdiv\', \'post\', \'normal\');
remove_meta_box(\'commentstatusdiv\', \'post\', \'normal\');
remove_meta_box(\'postcustom\', \'post\', \'normal\');
remove_meta_box(\'commentstatusdiv\', \'post\', \'normal\');
remove_meta_box(\'commentsdiv\', \'post\', \'normal\');
remove_meta_box(\'revisionsdiv\', \'post\', \'normal\');
remove_meta_box(\'authordiv\', \'post\', \'normal\');
remove_meta_box(\'slugdiv\', \'post\', \'normal\');
}
}
add_action( \'admin_menu\', \'remove_post_meta_boxes\' );
endif;
这是metabox Facebook AWD管理器的代码
<div class="AWD_facebook_wrap">
<h2>Like Button</h2>
<div class="alert alert-info">
<div class="AWD_facebook_likebutton"><div class="fb-like" data-href="http://www.dogsheaven.net/?p=703" data-send="0" data-layout="standard" data-width="250" data-show-faces="0" data-action="like" data-colorscheme="light" data-font="arial" data-ref=""></div></div>
</div>
<div class="row">
<div class="span3">
<label for="awd_fcbk_option_like_button_redefine">Redefine globals settings ?</label>
<select id="awd_fcbk_option_like_button_redefine" name="awd_fcbk_option_like_button[redefine]" class="span3" >
<option value="0" selected="selected" >No</option><option value="1" >Yes</option>
</select>
</div>
<div class="span3">
<label for="awd_fcbk_option_like_button_enabled">Activate ?</label>
<select id="awd_fcbk_option_like_button_enabled" name="awd_fcbk_option_like_button[enabled]" class="span3" >
<option value="0" >No</option><option value="1" selected="selected" >Yes</option>
</select>
</div>
<div class="span3">
<label for="awd_fcbk_option_like_button_place">Where ?</label>
<select id="awd_fcbk_option_like_button_place" name="awd_fcbk_option_like_button[place]" class="span3" >
<option value="top" selected="selected" >Top</option><option value="bottom" >Bottom</option><option value="both" >Both</option>
</select>
</div>
</div>
</div></div>
最合适的回答,由SO网友:birgire 整理而成
您可以尝试将这一行添加到admin_menu
过滤器:
remove_meta_box(\'awd_fcbk_awd_mini_form_metabox\', \'post\', \'side\');
在哪里
awd_fcbk
是插件slug。
Edit:
这是我从插件源代码中瞄准的元盒:
//Like button manager on post page type
add_meta_box($this->plugin_slug . "_awd_mini_form_metabox", __(\'Facebook AWD Manager\', $this->ptd) . \' <img style="vertical-align:middle;" style="vertical-align:middle;" src="\' . $this->plugin_url_images . \'facebook-mini.png" alt="facebook logo"/>\', array(&$this, \'post_manager_content\'), $type, \'side\', \'core\');