【发布时间】:2015-05-19 10:07:17
【问题描述】:
I have created a plugin called "add menu to dash board". For that I have created folder addmenu in wordpress's plugin folder.
In that folder my main php file of the plugin and the otherentry.php`文件存在。
通过插件,我创建了一个菜单和子菜单、信息和条目、链接。
现在我想在单击 submenu(entry) 时重定向到 entry.php 文件,因为我有一个简单的 html 表单,我想从中插入数据到数据库中。
那么有人可以帮我解决这个问题吗?
我已经读出了 require_once(),require_once() & include_once(), include()。但我不明白。
function register_my_custom_menu_page()
{
//add_menu_page('custom menu title', 'custom menu', 'add_users', 'custompage', '_custom_menu_page', null, 6);
add_menu_page("Info", "Info", 0, "info-slug", "infoPageFunction","", 6);
add_submenu_page("info-slug", "Entry", "Entry", 0, "entry-slug", "entryPageFunction");
add_submenu_page("info-slug", "Link", "Link", 0, "link-slug", "linkPageFunction");
}
add_action('admin_menu', 'register_my_custom_menu_page');
function entryPageFunction()
{
//~ echo '<script>
//~ window.location="/var/www/html/wordpress/wp-content/plugins/addmenu/entry.php";
//~ </script>';
require_once( add_Cmenu__PLUGIN_DIR . 'entry.php' );
}
上面的代码我试过了
也试过这个:-include( plugin_dir_path( __FILE__ ) . 'add_Cmenu/entry.php');
【问题讨论】:
-
我不确定问题是什么...您需要帮助插入菜单或如何处理表单数据?
-
请添加您已经尝试过的代码。
-
不,我已插入菜单。
-
现在我只想在单击名为“entry”的子菜单时重定向到 php 文件.....我创建的菜单 id 像 Info(main menu),entry&link(submenu)
-
请帮帮我......@mjk 我已经插入了我的代码