我正在寻找一个完全空白的仪表板。根本没有小部件,最好是一列。
有一些片段可以删除默认的WordPress小部件,但没有找到任何关于插件添加的小部件的信息。搜遍了所有地方,似乎还没有人问这个问题。
我正在寻找一个完全空白的仪表板。根本没有小部件,最好是一列。
有一些片段可以删除默认的WordPress小部件,但没有找到任何关于插件添加的小部件的信息。搜遍了所有地方,似乎还没有人问这个问题。
从…起this Q&A, 我已经了解了全局变量$wp_meta_boxes
. 另外还有删除默认元框的代码。
检查完变量后,这是我为删除所有仪表板小部件而编写的代码,including the ones added by plugins:
add_action(\'wp_dashboard_setup\', \'wpse_73561_remove_all_dashboard_meta_boxes\', 9999 );
function wpse_73561_remove_all_dashboard_meta_boxes()
{
global $wp_meta_boxes;
$wp_meta_boxes[\'dashboard\'][\'normal\'][\'core\'] = array();
$wp_meta_boxes[\'dashboard\'][\'side\'][\'core\'] = array();
}
答案是force one column 作为屏幕选项from here:add_filter( \'get_user_option_screen_layout_dashboard\', \'wpse_4552_one_column_layout\' );
function wpse_4552_one_column_layout( $cols ) {
if( current_user_can( \'basic_contributor\' ) )
return 1;
return $cols;
}
<小时>This one 提供了隐藏屏幕选项和帮助选项卡的代码:add_filter( \'contextual_help\', \'wpse_25034_remove_dashboard_help_tab\', 999, 3 );
add_filter( \'screen_options_show_screen\', \'wpse_25034_remove_help_tab\' );
function wpse_25034_remove_dashboard_help_tab( $old_help, $screen_id, $screen )
{
if( \'dashboard\' != $screen->base )
return $old_help;
$screen->remove_help_tabs();
return $old_help;
}
function wpse_25034_remove_help_tab( $visible )
{
global $current_screen;
if( \'dashboard\' == $current_screen->base )
return false;
return $visible;
}
好了,现在仪表板上几乎什么都没有了,接下来怎么办一点CSShide 这个icon-index
和H2 title
, 还有一些jQueryfill the void:
add_action( \'admin_head-index.php\', \'wpse_73561_dashboard_scripts\' );
function wpse_73561_dashboard_scripts() {
?>
<style>#icon-index, .wrap h2 {display:none}</style>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function($) {
fillTheVoid(); // soon in StackOverflow
});
</script>
<?php
}
更新填充的空隙可在中找到StackOverflow.
Use that wpse_73561_dashboard_scripts
函数而不是此函数。
这很好用
add_action(\'wp_dashboard_setup\', \'remove_dashboard_widgets\' );
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes[\'dashboard\']);
}
我有一个奇怪的问题,我还不能解决。我安装了wordpress 3.4.1并制作了自己的模板。我使用一个插件-qTranslate。在我的本地副本和dev copy dev.mysite上,一切都很好。捷克。当我复制wordpress并登录主站点时,http://www.mysite.cz, 仪表板不显示。取而代之的是,我只在主页的顶部有一个管理面板。到目前为止,我唯一能说的区别是wp配置。php文件。在生产模式中,我还有另外两条指令:/** debugging mode */ define(\'W