admin管理员组文章数量:1130349
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 badge1 Answer
Reset to default 0You 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
}
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 badge1 Answer
Reset to default 0You 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
}
本文标签: Insert link in sub menuAdmin panel
版权声明:本文标题:Insert link in sub menu - Admin panel 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749138868a2321840.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论