傻大憨

为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建外贸多语种网站的必要性

使用WordPress搭建外贸多语种网站是必要的。通过满足不同语言需求、提升搜索引擎优化、提高用户体验、降低成本、提高品牌知名度和适应全球化趋势等方面的优势,多语种网站可以帮助企业更好地拓展海外市场并提高竞争力。因此,对于有志于拓展海外市场的企业来说,建立一个多语种网站是至关重要的。

wordpress网页版入口介绍

WordPress是一个免费和开源的博客建立平台,它是目前最受欢迎的内容管理系统(CMS)之一,它的目标是简化网站的创建和管理流程。

把WordPress网站文章时间格式改为“几分钟前”

刚才访问一个网站时,发现这个网站文章发布时间并不是直接显示为具体时间,而是显示为“几分钟前”,大半夜的,不可能那么多文章都是几分钟前发布的,于是找了一下相关的教程,发现要实现这个挺简单的。

实现wordpress一篇文章只允许同一IP评论一次

让一个IP只能评论一次

WordPress外贸建站服务的最佳实践

  在竞争激烈的外贸市场,成功建站不仅仅是网站的技术实现,更涉及到对业务的高效管理。本文将介绍一些WordPr… Continue reading WordPress外贸建站服务的最佳实践