PHP code example of duckdev / wp-flash-notices

1. Go to this page and download the library: Download duckdev/wp-flash-notices 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/ */

    

duckdev / wp-flash-notices example snippets


use DuckDev\WP_Flash_Notices as My_Custom_Notices;

$notices = new My_Custom_Notices( 'my-custom-notices' );

// Register new success notice to the queue.
$notices->add( 'custom-success', 'This is a custom success notice.', 'success' );

// Register new error notice to the queue.
$notices->add( 'custom-error', 'This is a custom error notice.', 'error' );

// Register new warning notice to the queue.
$notices->add( 'custom-warning', 'This is a custom warning notice.', 'warning' );

// Register new info notice to the queue.
$notices->add( 'custom-info', 'This is a custom info notice.', 'info' );

// Register new info notice to the queue.
$notices->add( 'custom-success', 'This is a custom dismissible notice.', 'success', true );

// Register new info notice to the queue.
$notices->add( 'custom-success', 'This is a custom dismissible notice.', 'success', true, true );

do_action( 'front_notices' );