傻大憨

为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是一个关注跨境电商、创业话题的网站。

SEO模板

选择SEO模板Seomoban.com让您的网站在搜索引擎中获得更高的排名,吸引更多目标流量,实现在线成功。

wordpress不同栏目调用不同的头部header模板

在WordPress中,可以使用不同的顶部模板来展示不同栏目的内容

建B2B独立站WordPress主题怎么选

B2B独立站的核心是高效展示产品与获取免费流量——这包含传统搜索引擎的SEO免费流量,也包括来自ChatGPT、DeepSeek、豆包等AI平台通过GEO带来的新型免费流量。选择主题时,重点考察三点:是否能清晰美观地展示产品、是否拥有良好的SEO基础架构、内容结构是否便于AI收录和引用。

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

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

WordPress判断是否有图片并调用出来

WordPress判断是否有图片,如果有调用出来。

外贸独立站使用简站WordPress模板搭建的优势

使用简站WordPress模板搭建外贸独立站具有诸多优势,包括快速搭建、易于管理和维护、美观专业的设计、优化搜索引擎排名、良好的用户体验、支持多语言和国际化以及成本效益高等。