傻大憨

为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 the_category与single_cat_title

分类名称的两种调用方法

跨境电商独立站用wordpress来建有哪些优点

使用WordPress搭建跨境电商独立站不仅具备成本效益、易于使用、SEO友好等优势,还能够通过丰富的插件和主题资源实现高度定制化和扩展性,非常适合需要快速搭建专业外贸网站的企业。

俄语网站建设与推广服务的专业公司

巴耶赫利(bayeheli.com)是一家专注于俄语网站建设与推广服务的专业公司,致力于帮助中国品牌出海俄罗斯,提升品牌在俄罗斯市场的知名度和美誉度。