wp-notice is a simple library for WordPress plugins to display notices in admin area.
This library can display simple notices (error, warning, success, info) and dismissible notices. It also handles dismiss functionality with AJAX requests.
PHP 5.5 or later.
You can install the bindings via Composer. Run the following command:
composer require wpdesk/wp-notice
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
If you do not wish to use Composer, you can download the latest release. Then, to use the Notices, include the init.php file.
require_once('/path/to/wp-desk/wp-notice/init.php');
Simple usage looks like:
$notice = wpdesk_wp_notice('Notice text goes here');
// Is equivalent to:
$notice = WPDeskWpNotice('Notice text goes here');
// Is equivalent to:
$notice = \WPDesk\Notice\Factory::notice('Notice text goes here');
// Is equivalent to:
$notice = new \WPDesk\Notice\Notice('Notice text goes here');
Notice must be used before WordPress action admin_notices
. WordPress admin actions order is listed here.