admin管理员组文章数量:1122846
I'm creating a plugin with custom pages on wp-admin side. I have the main level page, which is actually just the menu and then child pages, which opens different pages. So far it's working as expected. I can load the data I need and display it on the page as expected. This is my code so far:
add_action('admin_menu', function() {
$icon = '<svg>...</svg>';
add_menu_page('Financial', 'Financial', 'manage_options', 'myplugin-finance', 'render_page_base', 'data:image/svg+xml;base64,'.base64_encode($icon));
// Add child pages
add_submenu_page('myplugin-finance', 'Overview', 'Overview', 'manage_options', 'overview', 'render_page_overview');
add_submenu_page('myplugin-finance', 'Transactions', 'Transactions', 'manage_options', 'transactions', 'render_page_transactions');
add_submenu_page('myplugin-finance', 'Customers', 'Customers', 'manage_options', 'customers', 'render_page_customers');
add_submenu_page('myplugin-finance', 'Transfers', 'Transfers', 'manage_options', 'transfers', 'render_page_transfers');
// Remove parent from child menu list
remove_submenu_page('myplugin-finance','myplugin-finance');
});
I tried to create the page details like this:
add_submenu_page('transactions', 'Transaction details', 'Transaction details', 'manage_options', 'transactions-details', 'render_page_transactions_details');
I can open this page, but the menu isn't opened and/or selected on the correct menu item. Is there a way to achieve this? Woocommerce product does what I want to do. If you select the list of products, the Woocommerce menu stay opened with Products selected. If you then select one product to edit its details, the menu stays the same. Forminator is also another plugin I use that does this, but I was not able to identify how they do that.
This is my desired result:
本文标签: plugin developmentCreate child of child custom page in wpadmin
版权声明:本文标题:plugin development - Create child of child custom page in wp-admin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308407a1933650.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论