$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Insert link in sub menu - Admin panel|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Insert link in sub menu - Admin panel

matteradmin10PV0评论

Hi this is my code.

add_menu_page('Titlemenu', 'Titlemenu', 'read', 'a-functions', array(&$this,'namefunctions1'));
    add_submenu_page('a-functions', 'title1submenu', 'title1submenu', 'read', 'a-functions', array(&$this,'namefunctions1'));
    add_submenu_page('a-functions', 'title2submenu', 'title2submenu', 'read', 'a-functions2', array(&$this,'namefunctions2'));

I would like to insert a file download when user clicked in the first sub menu.

This is a classic functions for connect submenu to page to be displayed.

    function namefunctions1(){
    <div class="wrap">
     <?php
      include_once(dirname( __FILE__ ) . "/file.htm");
     ?>
    </div>

Thanks for help

Hi this is my code.

add_menu_page('Titlemenu', 'Titlemenu', 'read', 'a-functions', array(&$this,'namefunctions1'));
    add_submenu_page('a-functions', 'title1submenu', 'title1submenu', 'read', 'a-functions', array(&$this,'namefunctions1'));
    add_submenu_page('a-functions', 'title2submenu', 'title2submenu', 'read', 'a-functions2', array(&$this,'namefunctions2'));

I would like to insert a file download when user clicked in the first sub menu.

This is a classic functions for connect submenu to page to be displayed.

    function namefunctions1(){
    <div class="wrap">
     <?php
      include_once(dirname( __FILE__ ) . "/file.htm");
     ?>
    </div>

Thanks for help

Share Improve this question edited Nov 30, 2018 at 12:18 wordpress dev02 asked Nov 30, 2018 at 8:26 wordpress dev02wordpress dev02 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

You can try this.

add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page() {
    add_menu_page(
        'My Custom Page',
        'My Custom Page',
        'manage_options',
        'my-top-level-slug',
        '',
        'dashicons-menu',
        6
    );
    add_submenu_page( 'my-top-level-slug', 'My Custom Page', 'My Custom Page',
    'manage_options', 'my-top-level-slug', 'custom_subpage_first');
    add_submenu_page( 'my-top-level-slug', 'My Custom Submenu Page 1', 'My Custom 
    Submenu Page','manage_options', 'my-secondary-slug', 'custom_subpage_second');
}

function custom_subpage_first() {
?>
    <div class="wrap">
       <?php include_once(dirname( __FILE__ ) . "/file.htm");?>
    </div>
<?php
}
function custom_subpage_second() {
?>
    <div class="wrap">
       /*Second subpage content */
    </div>
<?php
}

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far