wp-user-manager/wp-notices
Composer 安装命令:
composer require wp-user-manager/wp-notices
包简介
An helper library to create persistent and dismissible WordPress admin notices.
关键字:
README 文档
README
An helper library to create persistent and dismissible WordPress admin notices.
Installation
Composer is required.
composer require alessandrotesoro/wp-notices
Usage
Import the library and assign it your own namespace:
use TDP\WP_Notice as MYNOTICES;
Create a wrapper function:
function mynotices() { return MYNOTICES::instance(); }
Create a global notice for all users:
mynotices()->register_notice( 'my_notice', 'warning', 'This is the message' ) );
Or create a notice for the currently logged in user only:
mynotices()->register_notice( 'my_notice', 'warning', 'This is the message', array( 'scope' => 'user' ) ) );
Available parameters
| Parameter | Type | Options | Defaults | Description |
|---|---|---|---|---|
| id | string | Required ID to identify the notice | ||
| type | string | success, warning, error, info | Determine the type of notice | |
| message | string | The message you wish to display within WordPress | ||
| args | array | scope (global, user), dismissible (true/false), cap, class | scope = global, dismissible = true | Additional settings available for the notice |
统计信息
- 总下载量: 4.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-01-05