2016-12-29 142 views
1

我只是確保我正確地在儀表板上創建子菜單。Wordpress問題創建子菜單

我看就如何在Youtube

問題創建一個設置API的教程是,當我每次懸停在ALLB期權坐不彈出與子菜單。

任何人都可以幫助這個關於WordPress的快速問題,請詳細解釋一下嗎?

<?php 

/* 

    ==================== 
       Admin Page 
    ==================== 

*/ 

function allb_admin_page() { 
    //Generate A Legacy Left Behind Admin Page 
    add_menu_page(' ALLB Theme Options', 'ALLB Options', 'manage_options', 'a_legacy_left_behind', 'allb_theme_create_page', 'dashicons-admin-customizer', 110); 
    //Generate A Legacy Left Behind Admin Sub Page 
    add_submenu_page('allb_theme', 'ALLB Theme Options', 'Setting', 'manage_options', 'a_legacy_left_behind', 'allb_theme_settings_page'); 
} 

add_action('admin_menu', 'allb_admin_page'); 

function allb_theme_create_page() { 
    // genration of our admin page 
} 

function allb_theme_settings_page() { 
    // genration of our admin page 
} 

回答

1

下面是答案..

只需複製和過去的這段代碼在你的主題的functions.php文件..

請你嘗試一次呢?

add_action('admin_menu', 'my_menu_pages'); 
function my_menu_pages(){ 
    add_menu_page('My Page Title', 'My Menu Title', 'manage_options', 'my-menu', 'my_menu_output'); 
    add_submenu_page('my-menu', 'Submenu Page Title', 'Whatever You Want', 'manage_options', 'my-menu'); 
    add_submenu_page('my-menu', 'Submenu Page Title2', 'Whatever You Want2', 'manage_options', 'my-menu2'); 
} 

我希望它有助於你..

0

希望這將解決您的問題

function allb_admin_page() { 
    //Generate A Legacy Left Behind Admin Page 
    add_menu_page('ALLB Theme Options', 'ALLB Options', 'manage_options', 'a_legacy_left_behind', 'allb_theme_create_page'); 
    //Generate A Legacy Left Behind Admin Sub Page 
    add_submenu_page('a_legacy_left_behind', 'ALLB Theme Options', 'Setting', 'manage_options', 'a_legacy_left_behind_sub', 'allb_theme_settings_page'); 
}