Skip to content

aguidrevitch/wp-notice

 
 

Repository files navigation

pipeline status coverage report Latest Stable Version Total Downloads Latest Unstable Version License

WordPress Library to display notices in admin area.

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.

Requirements

PHP 5.5 or later.

Composer

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';

Manual instalation

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');

Getting Started

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.

Project documentation

PHPDoc: https://wpdesk.gitlab.io/wp-notice/index.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 97.7%
  • JavaScript 2.3%