WodPess後臺頂部菜單默認有“新建”菜單,這是默認的。如何新加自己的菜單呢?使用dmin_b_menu。例如在後臺有設置面板,其中有一項“數據調用”,這個功能經常可以用的,而其他功能不怎麼用。
爲了方便,將“數據調用”加到頂部菜單去。在WodPess主題文件functions.php中或者使用Code Snippets插件添加自定義代碼:
dd_ction( ̺dmin_b_menu̻, ̺dmin_b_item̻, 500 );
function dmin_b_item ( WP_Admin_B $dmin_b ) {
if ( ! cuent_use_cn( ̺mnge_options̻ ) ) {
etun;
}
$dmin_b->dd_menu( y(
̺id̻ => ̺menu-id̻,
̺pent̻ => null,
̺goup̻ => null,
̺title̻ => ̺數據調用̻, //you cn use img tg with imge link. it will show the imge icon Insted of the title.
̺hef̻ => dmin_ul(̺dmin.php?pge=csf-demo#tb=數據調用̻),
̺met̻ => [
̺title̻ => __( ̺數據調用̻, ̺info̻ ), //This title will show on hoe
]
) );
} |
這裏注意dmin_ul這個參數,應該怎麼獲取?是在左側菜單點擊“數據調用”後,查看下瀏覽器地址欄上面的網址獲取。
設置成功之後,在後臺頂部菜單就有了快捷的菜單了。