控制 WordPress 插件和主题通知

长期以来,插件通知一直是 WordPress 中的一个问题。上周我在 Slack 上看到一个对话,一个开发人员说他认为他们已经失控了,然后发布了这个截图:

如此多的通知您甚至看不到仪表板内容。

一个管理 Notifications 的核心项目,但在一个有希望的开始(有一些非常好的设计)之后,进展已经放慢了很多。Make 博客上不再有更新,但Github 上对话我希望这个项目能再次启动,我们得到一个适当的通知系统,但在那之前我想知道“我能做的最简单的事情是什么来改善情况?”

该提案包括核心 API 和标准设计,但这需要开发人员遵循标准并更新现有插件以匹配。这将需要很长时间,因为开发人员还希望通知能够与不更新其 WordPress 安装的旧站点一起使用。

我的答案是使用 JavaScript 获取当前页面上的所有通知,并将它们粘贴在可以打开和关闭的隐藏侧边栏中。这将通知置于视野之外,同时使它们易于访问。

这是在我的开发服务器上运行所以忽略所有奇怪的内容

这可能不是一个完美的解决方案。许多插件使用 WordPress 核心 html 类,但有些插件没有使用,因此可能会被遗漏。此外,我决定过滤掉一些通知,以便成功和错误消息显示正常。

在我有限的测试中,这使事情有了很大的改善。如果缺少通知,我添加了一个链接来创建 github 问题,以便可以改进插件。

为什么不帮助核心项目?

Unfortunately I don’t have the time to commit to regular meetings and updates for the core project. Plus, core just moves too slowly for me, I want to make something simple that works now. When I build these things I can make decisions on my own and implement them quickly.

However, my code for Toolbelt is all public and GPL, and so anyone can take it and use it as a basis for their own work, or contribute to my version.

There’s definite benefits to working as a team, and I want core to have this feature included. I see the Tidy Notifications module as a stop gap until core has full support, and I look forward to the day I can disable it.

Get it now

I added the functionality to my plugin, Toolbelt. Toolbelt is a multi-purpose plugin that adds lots of functionality I use regularly across my sites. I built it for me, so there’s an eclectic mix of functionality, but all the features are built to be as minimal, and private, as possible whilst getting the job done to the best of their ability.

To Tidy your Notifications you shoud install the plugin and then go to the Toolbelt settings screen and enable the Tidy Notifications module.

Toolbelt has a lot of modules, and they are all disabled by default. The plugin is a visitor on your website and so you should control what features are enabled.

Feedback

I’d love to hear if you use Toolbelt, in particular the Tidy Notifications module. I want to know what notifications the plugin doesn’t catch, or does catch but shouldn’t, so that I can attempt to improve it. This module was made over a couple of evenings and so I’m sure there’s things I could do to improve it.

Let me know in the comments, or on the Github repository.


Ben

Ben is a lifelong Nintendo fan who likes to build websites, and make video games. He buys way too much Lego.

相关推荐: Linux一键安装脚本–支持 Debian 11 和 Ubuntu 20.04 自动安装

下载自动安装安装脚本wget git.io/auto.shLinux一键安装脚本 安装命令参考# 自动安装 Debian 10 buster bash auto.sh -d 10 -v 64 -a -p 密码 # 自动安装 Debian 11 bullseye…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享