傻大憨

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

single文章页获取父分类别名

将下面这段代码添加到single.php中需要显示父分类别名的位置,就可以显示出父分类的别名。

wordpress导入mysql数据库文件的方法及注意事项

在某些情况下,您可能需要将现有的 MySQL 数据库导入到新的 WordPress 安装中。本文将介绍如何导入 MySQL 数据库文件到 WordPress 以及需要注意的事项。

wordpress企业网站模板包含的页面

常见wordpress企业网站模板包含的页面

买WordPress主题自己搭建网站需要注意些什么

在选择和购买WordPress主题时,有很多需要注意的地方,以确保自己的网站能够顺利搭建并正常运行。

简站WP主题的“简洁、高效”具体体现在哪些方面?

简站WP主题通过简洁的设计、高效的性能、无插件原则、响应式设计、SEO优化、易用性和安全性等方面,为用户提供了一个高效、安全且易于管理的建站解决方案。

用wordpress的soho人需要注意的事项

使用WordPress自建网站的SOHO人士需要注意以下几个关键事项,可以确保他们的WordPress网站能够稳定运行,同时为用户提供良好的体验。