feat:管理后台菜单完成

This commit is contained in:
sunxiyuan 2020-07-14 11:45:12 +08:00
parent 0c70ceef26
commit aad6ea29a6
2 changed files with 62 additions and 15 deletions

View file

@ -9,10 +9,55 @@
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
if (is_admin()) {
/**
* 使用Composer作PHP文件自动加载
*/
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
if ( file_exists( __DIR__ . '/vendor/loco-translate/loco.php' ) ) {
require __DIR__ . '/vendor/loco-translate/loco.php';
}
/**
* WP-China-Yes的翻译校准基于Loco Translate插件开发这里通过引入入口文件的方式激活该插件的二次开发版
*/
if ( file_exists( __DIR__ . '/vendor/loco-translate/loco.php' ) ) {
require __DIR__ . '/vendor/loco-translate/loco.php';
}
/**
* 菜单注册
*/
add_action('admin_menu', function () {
add_menu_page(
'本土化',
'本土化',
'',
'wpcy'
);
add_submenu_page(
'wpcy',
'系统本土化',
'系统本土化',
'manage_options',
'wpcy-setting',
function () {
echo 'a';
},
0
);
add_submenu_page(
'wpcy',
'关于',
'关于',
'manage_options',
'wpcy-about',
function () {
echo 'a';
},
3
);
});
}