![](https://i-blog.csdnimg.cn/blog_migrate/b935f78bcb4b73d7a6f3a65217910206.png)
wordpress弹窗通知
WordPress allow plugin and theme authors to display notices in the admin area to keep users informed about new features and updates. However at the speed WordPress ecosystem is growing, the admin notices can get out of control.
WordPress允许插件和主题作者在管理区域中显示通知,以使用户随时了解新功能和更新。 但是,随着WordPress生态系统的快速发展,管理员通知可能会失控。
Updating your plugins and seeing half your screen covered with admin notices is extremely annoying.
更新您的插件,并看到一半的屏幕上显示管理员通知,这非常烦人。
![Notifications in the admin area of a WordPress site Notifications in the admin area of a WordPress site](https://i-blog.csdnimg.cn/blog_migrate/e89a08fbe0860bf0c2eeb0b85c68a70e.png)
However, it’s even more frustrating as plugin authors because we’re the ones that get blamed for it.
但是,作为插件作者,这更加令人沮丧,因为我们为此而受到责备。
Then of course there are plugins who misuse admin notices for promotional purposes. Some that you can’t even close. After seeing Jeff’s article on WPTavern and reading some of the comments, we felt compelled to write about this topic and offer a suggestion that can possibly fix the problem.
然后当然还有一些插件,它们出于促销目的滥用管理通知。 有些您甚至无法关闭。 在看到Jeff关于WPTavern 的文章并阅读了一些评论之后,我们感到不得不写这个话题,并提出可以解决该问题的建议。
If you think admin notices are getting out of control, then you should know that it’s only going to get worst (unless something is done about it).
如果您认为管理员通知已失去控制,那么您应该知道它只会变得更糟(除非对此有所处理)。
Currently there 44,000+ WordPress plugins in the official plugin directory. Not including thousands that are hosted on Github or commercial WordPress plugins.
目前,官方插件目录中有超过44,000个WordPress插件。 不包括Github或商业WordPress插件上托管的数千个。
As more developers enter the WordPress ecosystem and new plugins are created, you can imagine that there will be a time when you update 5 plugins and see 5 different admin notices.
随着越来越多的开发人员进入WordPress生态系统并创建新的插件,您可以想象会有一段时间更新5个插件并看到5个不同的管理员通知。
So what’s the solution?
那么解决方案是什么?
A centralized Notification Center.
集中式通知中心。
You see, when we converted OptinMonster from a WordPress plugin into a software as a service (SaaS app), one of the first things we built was a notification center to keep our users notified of new changes.
您会看到,当我们将OptinMonster从WordPress插件转换为软件即服务(SaaS应用程序)时,我们构建的第一件事就是一个通知中心,该通知中心可以使用户随时了解新的更改。
![OptinMonster Notification Center OptinMonster Notification Center](https://i-blog.csdnimg.cn/blog_migrate/97aacbc26754b447ffb8ee5dccdb7b67.png)
This was very well received by our audience. Users can mark a notice as read and they can always go back to read previous notices. It’s unobtrusive and serves its purpose well. Those who want to stay updated read the notification, others can ignore it by marking it as read.
这深受我们的听众的好评。 用户可以将通知标记为已读,并且他们可以随时返回以阅读以前的通知。 它不显眼,可以很好地实现其目的。 想要保持更新的人可以阅读通知,其他人可以通过将其标记为已读来忽略它。
At Awesome Motive, we have had several internal discussions about building our own notification system for our suite of WordPress plugins.
在Awesome Motive上 ,我们就如何为WordPress插件套件构建自己的通知系统进行了几次内部讨论。
But that’s not feasible considering we have so many plugins. If we ever have to update a potential bug in the notification center, then we would have to simultaneously update all our plugins.
但是考虑到我们有太多的插件,这是不可行的。 如果我们必须在通知中心更新潜在的错误,那么我们将必须同时更新所有插件。
A better solution would be if a notification center was added into WordPress core, and there was a standardized way that all developers would follow.
更好的解决方案是将通知中心添加到WordPress核心中,并且所有开发人员都应遵循一种标准化的方式。
There’s a nice proof of concept available in the form of a WordPress plugin that Barry Kooij created called WP Notification Center (we wrote about it here).
Barry Kooij创建了一个名为WP Notification Center的WordPress插件,形式上有一个很好的概念证明(我们在此处进行了介绍 )。
![WordPress Notification Center WordPress Notification Center](https://i-blog.csdnimg.cn/blog_migrate/ac6f10dc6eb2135607a9d219252ae059.png)
Currently that plugin doesn’t have the option to dismiss the notification or read the full details. But it’s a great start to solving this problem.
目前,该插件无法选择关闭通知或阅读全部详细信息。 但这是解决此问题的一个很好的开始。
How many of you would like to see a notification center built into WordPress core?
你们中有多少人希望看到WordPress核心内置的通知中心?
Let us know your thoughts by leaving your comments below.
在下面留下您的评论,让我们知道您的想法。
wordpress弹窗通知