From 53c14ac277cbb7f721d089176c41b757ed1e0d05 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Thu, 9 Jun 2022 14:20:29 +0200 Subject: [PATCH] feature(readme): readme --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e1c28b..384bddf 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ require_once('/path/to/wp-desk/wp-notice/init.php'); ## Getting Started -Simple usage looks like: +###Simple usage looks like ```php $notice = wpdesk_wp_notice('Notice text goes here'); @@ -61,8 +61,24 @@ Notice must be used before WordPress action `admin_notices`. WordPress admin act ## Permanent dismissible notices +### AJAX handler + To use permanent dismissible notices AJAX handler must be created and hooks initialized: ```php - ( new \WPDesk\Notice\AjaxHandler() )->hooks(); +wpdesk_init_wp_notice_ajax_handler(); + +// Is equivalent to: +( new \WPDesk\Notice\AjaxHandler() )->hooks(); +``` + +### Displaying + +To display permanent dismissible notice: + +```php +wpdesk_permanent_dismissible_wp_notice( 'Notice text goes here', 'notice-name' ); + +// Is equivalent to +new PermanentDismissibleNotice( 'Notice text goes here', 'notice-name' ); ``` -- GitLab