PHP code example of josantonius / wp-notice

1. Go to this page and download the library: Download josantonius/wp-notice library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

josantonius / wp-notice example snippets


WP_Notice::success($message, $dismissable);

WP_Notice::warning($message, $dismissable);

WP_Notice::error($message, $dismissable);



use Josantonius\WP_Notice;



use Josantonius\WP_Notice\WP_Notice;

WP_Notice::success('Success example');
WP_Notice::success('Success not dismissable', false);

WP_Notice::warning('Warning example');
WP_Notice::warning('Warning not dismissable', false);

$error = new \WP_Error('error', 'Example of error creation from WP_Error');

WP_Notice::error($error);
WP_Notice::error('Example of error creation without going through WP_Error');
WP_Notice::error('Error not dismissable', false);