wp-user-manager / wp-notices
一个用于创建持久和可消失的WordPress管理员通知的辅助库。
1.0.3
2019-05-29 11:24 UTC
Requires
- php: >=5.3.2
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2024-09-05 15:26:48 UTC
README
一个用于创建持久和可消失的WordPress管理员通知的辅助库。
安装
需要Composer。
composer require alessandrotesoro/wp-notices
用法
导入库并分配自己的命名空间
use TDP\WP_Notice as MYNOTICES;
创建包装函数
function mynotices() { return MYNOTICES::instance(); }
为所有用户创建全局通知
mynotices()->register_notice( 'my_notice', 'warning', 'This is the message' ) );
或只为当前登录用户创建通知
mynotices()->register_notice( 'my_notice', 'warning', 'This is the message', array( 'scope' => 'user' ) ) );