juvo/wp-admin-notices
最新稳定版本:v1.0.2
Composer 安装命令:
composer require juvo/wp-admin-notices
包简介
Adds a wrapper layer to store notices for wptrt/admin-notices
关键字:
README 文档
README
This is an extension for the wptrt/admin-notices package to store notices in a transient. The goal is to allow a dynamic storing process throughout WordPress. Since this package is only a proxy that stores the notices in the database, you can find examples and options in the wptrt/admin-notices repository.
Usage
// Display stored notices add_action( 'admin_init', function() { $notices = new \juvo\WordPressAdminNotices\Manager(); $notices->notices(); } ); // Add a notice. \juvo\WordPressAdminNotices\Manager::add((string) $id, (string) $title, (string) $content, (array) $options); // Remove a notice. \juvo\WordPressAdminNotices\Manager::remove((string) $id, (bool) $onlyGlobal); //Example: Check if Advanced Custom Fields Pro is installed if ( ! class_exists( 'acf_pro' ) ) { // Add a notice. Manager::add( "missing_plugin", "Required plugin missing","The advanced custom fields plugin is required for this plugin to work" ), [ "type" => "error" ] ); } else { Manager::remove( "missing_plugin"); }
wptrt/admin-notices parameters are fully supported. If a notice with global scope is dismissed, it will be automatically removed from the transient. Additionally a max_age parameter can be passed to the Manager constructor.
All notices older than this value will be removed. Notices with a user scope are not removed from the transient by dismissing them. They will only be removed if they exceed the max_age. The transient itself does not expire at all.
Composer
From the command line:
composer require juvo/wp-admin-notices
统计信息
- 总下载量: 3.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-05-12