Download the PHP package rumur/wp-notice without Composer
On this page you can find all versions of the php package rumur/wp-notice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rumur/wp-notice
More information about rumur/wp-notice
Files in rumur/wp-notice
Package wp-notice
Short Description The OOP package to work with WordPress notices
License MIT
Homepage https://github.com/rumur/wp-notice
Informations about the package wp-notice
wp-notice
The small OOP wrapper that allows working with WordPress notices nice and clean.
Minimum Requirements:
- PHP: 7.2+
- WordPress: 5.3+
Installation
Themosis 2.x
Sage 10.x
Register into WordPress
It registers the renderer functionality, that will display all notifications added by the package.
How to use?
There are several types that could be used.
Notice::info(...)
, Notice::error(...)
, Notice::warning(...)
, Notice::success(...)
.
Each of these methods could take as a param either a string
or Noticeable
or \WP_Error
instances or regular callable function rmr_notice_as_function
that returns a string.
Available methods
Recurrence | Description |
---|---|
->nag(); |
Makes nag notice |
->dismissible(); |
Makes be closable/dismissible |
->showWhenRole(...string); |
Tells to show when the current user role is mentioned |
->showWhenRoleNot(...string); |
Tells to show when the current user role is not in a mentioned list |
->showWhenPage(...string); |
Tells to show when the current screen page is mentioned |
->showWhenPageNot(...string); |
Tells to show when the current screen page is not in a mentioned list |
->showWhenTaxonomy(...string); |
Tells to show when the current screen is for specific taxonomies |
->showWhenTaxonomyNot(...string); |
Tells to show when the current screen is not for taxonomies mentioned in a list |
->showWhenPostType(...string); |
Tells to show when the current screen is for specific post types |
->showWhenPostTypeNot(...string); |
Tells to show when the current screen is not for post types mentioned in a list |
->showWhenUser(...int/WP_User); |
Tells to show when the current user is mentioned |
->showWhenUserNot(...int/WP_User); |
Tells to show when the current user is not in a mentioned list |
->showLater(...string/int(timestamp)/DateTimeInterface); |
Tells to show the notice later when it's time |
->showUntil(...string/int(timestamp)/DateTimeInterface); |
Tells to show the notice until it's time |
Note, that all conditions are using
OR
operator to check, but if there is a time condition than it'll switch toAND
instead.
To delete all traces when uninstalling plugin/theme which is used the package.
In order to delete all traces just call the flush
method, like this Notice::flush()
.
License
This package is licensed under the MIT License - see the LICENSE.md file for details.
All versions of wp-notice with dependencies
ext-json Version *