博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
将菜单项添加到WordPress管理菜单
阅读量:2518 次
发布时间:2019-05-11

本文共 1599 字,大约阅读时间需要 5 分钟。

The existing menus in WordPress are solid but one annoyance is that I need to click "All Posts" and then the "Drafts" link to get to my drafts; I simply want to get there as quickly as possible via the Posts menu. I did some quick research on the topic and in two minutes I was able to add a "Drafts" submenu item to the "Posts" menu. Here's how I did it!

WordPress中的现有菜单是可靠的,但令人烦恼的是,我需要单击“所有帖子”,然后单击“草稿”链接以获取我的草稿; 我只是想通过“帖子”菜单尽快到达那里。 我对该主题进行了一些快速研究,并在两分钟内将“草稿”子菜单项添加到“帖子”菜单中。 这是我的方法!

Within the functions.php file of my current theme (this file gets loaded even for admin!), I added the following:

在当前主题的functions.php文件中(即使是管理员也要加载该文件!),我添加了以下内容:

// Add menu item for draft postsfunction add_drafts_admin_menu_item() {  // $page_title, $menu_title, $capability, $menu_slug, $callback_function  add_posts_page(__('Drafts'), __('Drafts'), 'read', 'edit.php?post_status=draft&post_type=post');}add_action('admin_menu', 'add_drafts_admin_menu_item');

The add_posts_page method is actually a shortcut for add_submenu_page, which allows you to add a submenu item for any existing menu item. And WordPress allows you to get pretty detailed with your own menus, as you can see here.

add_posts_page方法实际上是add_submenu_page的快捷方式,它允许您为任何现有菜单项添加子菜单项。 WordPress使您可以使用自己的菜单获得相当详细的信息,如此处所示。

This added "Drafts" link will save me click after click after click throughout my time using WordPress. Take the few moments to add links to existing menus as you'd like -- there's nothing like a fresh shortcut to get you moving faster!

这个添加的“草稿”链接将使我在使用WordPress的整个过程中单击后单击后再点击保存。 花一点时间将链接添加到现有菜单,这没有什么比让您更快移动的全新快捷方式了!

翻译自:

转载地址:http://qtpwd.baihongyu.com/

你可能感兴趣的文章
Linux lsof详解
查看>>
子组件给父组件传数据
查看>>
unix/linux下的共享内存、信号量、队列信息管理
查看>>
Hilbert先生旅馆的故事
查看>>
[家里蹲大学数学杂志]第394期分组求积分因子法
查看>>
[唐诗]送杜少府之任蜀州-王勃
查看>>
华中科技大学数学专业考研试题参考解答
查看>>
Objective-C数组初识
查看>>
appium(10)-iOS predictate
查看>>
程序的优化(PHP)
查看>>
Function.prototype.toString 的使用技巧
查看>>
Zookeeper+websocket实现对分布式服务器的实时监控(附源码下载)
查看>>
Oracle to_char 转换数值
查看>>
selinux-网络服务安全
查看>>
urllib
查看>>
NIOS II 中用结构体指示灯终于正常了
查看>>
CF1009F Dominant Indices - 题解
查看>>
memached实现tomcat的session共享
查看>>
django导出excel
查看>>
【搜索】数的划分
查看>>