傻大憨

为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 SOHO

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

wordpress子分类使用父分类模板

wordpress子分类继承使用父分类模板

为什么有些主题不支持elementor?

elementor是wordpress的一个第三方的插件,不是所有的wordpress主题,都必须要支持elementor

wordpress主题与wordpress模板有什么区别

主题是网站整体外观和风格的集合,而模板是构成主题的单个文件,定义了网站中不同页面的布局和结构。主题包含了多个模板文件,而模板文件则负责实现主题的具体展示。

外贸建站服务商WaiMaoYes

歪猫建站(WaiMaoYes)是一家专注于外贸网站建设的公司,提供从建站策划、网页设计、前后端开发到运营推广的… Continue reading 外贸建站服务商WaiMaoYes

WordPress the_category与single_cat_title

分类名称的两种调用方法

WordPress外贸建站平台在行业的领导地位

  在数字时代,建立一个强大而具有影响力的国际外贸网站对于企业来说至关重要。WordPress外贸建站平台凭借… Continue reading WordPress外贸建站平台在行业的领导地位