傻大憨

为wordpress后台添加一个自定义页面

非插件线代码方式实现为wordpress后台添加一个自定义页面

参数如下:

$page_title (string) – The text to be displayed in the title tags of the page when the menu is selected.
$menu_title (string) – The text to be used for the menu.
$capability (string) – The capability required for this menu to be displayed to the user.
$menu_slug (string) – The unique slug name to refer to this menu.
$callback (callable, optional) – The function to be called to output the content for this page. Default: ”
$position (int, optional) – The position in the menu order this item should appear. Default: null

将下面代码添加到functions.php中即可实现

function my_plugin_menu() {
    add_dashboard_page('My Custom Dashboard', 'Custom Dashboard', 'read', 'wodepress-custom-dashboard', 'wodepress_custom_dashboard_output');
}
add_action('admin_menu', 'my_plugin_menu');

function wodepress_custom_dashboard_output() {
    echo 'Welcome to My Custom Dashboard!';
}

所有登陆后台的用户可见

function my_plugin_menu() {
    add_dashboard_page('My Custom Dashboard', 'Custom Dashboard', 'edit_posts', 'wodepress-custom-dashboard', 'wodepress_custom_dashboard_output');
}
add_action('admin_menu', 'my_plugin_menu');

function wodepress_custom_dashboard_output() {
    echo 'Welcome to My Custom Dashboard!';
}

拥有编辑权限的用户可见

Published
Categorized as 建站知识 Tagged ,

By 傻大憨

shadahan.com是一个关注跨境电商、创业话题的网站。

企业官网用复杂wordpress模板 就是老板挖坑埋自己

简洁实用的WordPress模板能够更好地满足这些需求,同时降低维护成本和风险。复杂模板虽然在搭建时可能看起来很强大,但长期来看,它们可能会给企业带来不必要的麻烦和成本。

wordpress调用当前页面ID

在wordpress调用当前页面ID代码

外贸SOHO建wordpress询盘站年入百万

只要合理规划并坚持执行,独立站不仅可以帮助外贸SOHO快速积累询盘,还能实现长期的业务增长。

WordPress自建站如何备份和恢复数据

请注意,备份和恢复数据时,确保选择正确的备份文件,以免覆盖或恢复错误的数据。

WordPress外贸网站建设的核心元素与实际案例

  在竞争激烈的外贸市场中,成功建设一个专业且高效的WordPress外贸网站需要精心策划和正确实施。本文将深… Continue reading WordPress外贸网站建设的核心元素与实际案例

用wordpress搭建跨境电商独立站 成本低 效率高

跨境电商老板,为什么喜欢用wordpress搭建独立站。为什么说用wordpress搭建跨境电商独立站是成本最低效率最高的。