傻大憨

为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为不同页面调用不同头部header文件代码

不同页面调用不同的顶部header文件

国内企业建站为什么不用wordpress的原因找到了

WordPress的使用成本较低,许多用户通过购买模板或插件即可快速搭建网站,这导致了国内一些建站公司无法从中获得足够的利润。

企业官网在海外品牌推广中的重要工具

企业官网在海外品牌推广中不仅是品牌形象的展示窗口,更是市场拓展、客户互动和数据收集的重要工具。精心打造和优化企业官网,能够为企业在海外市场的发展提供强大的支持。

非插件纯代码方式实现WordPress SMTP邮件功能

非插件纯代码方式实现WordPressSMTP邮件功能

俄贸SEO :专业的俄罗斯外贸网络营销推广与Yandex SEO服务商

俄贸SEO yandex-seo.com凭借其专业的服务和丰富的经验,已成为众多企业进入俄罗斯市场、提升品牌知名度和销售业绩的可靠选择。

WordPress外贸网站建设的关键要素与技术要点

  在全球数字化的时代,成功建站是拓展国际业务的关键一环。本文将揭示WordPress外贸网站建设的关键要素与… Continue reading WordPress外贸网站建设的关键要素与技术要点