我们在做wordpress主题开发的时刻,为了越发的让使用者熟习本身做的wordpress主题,都会在主题背景做细致的形貌,有的时刻会想到在仪表盘上也加些教程链接和申明越发好,那末本日就教人人怎样给wordpress仪表盘增加自定义信息模块,下面就直接说教程了,翻开你们wordpress主题的functions.php文件,将一下代码到场:
function custom_dashboard_help() {
}
function example_add_dashboard_widgets() {
wp_add_dashboard_widget('custom_help_widget', '这里替换成面板标题', 'custom_dashboard_help');
}
add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' );
修正以上代码为本身的内容,再去仪表盘看看,是不是多出了自定义的信息模块涌现了!
别的同时教程也给出,怎样去掉wordpress仪表盘中无用的其他模块吧,一样照样在wordpress主题文件里的functions.php文件中到场以下代码:
//删除仪表盘模块
function example_remove_dashboard_widgets() {
// Globalize the metaboxes array, this holds all the widgets for wp-admin
global $wp_meta_boxes;
// 以下这一行代码将删除 "疾速宣布" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
// 以下这一行代码将删除 "引入链接" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
// 以下这一行代码将删除 "插件" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
// 以下这一行代码将删除 "近期批评" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
// 以下这一行代码将删除 "近期草稿" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
// 以下这一行代码将删除 "WordPress 开发日记" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
// 以下这一行代码将删除 "别的 WordPress 消息" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
// 以下这一行代码将删除 "概略" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
}
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
// 以下这一行代码将删除 "welcome" 模块
remove_action('welcome_panel', 'wp_welcome_panel');
依据以上解释去去掉本身所需要去掉的模块吧!

评论列表