forked from coderexpert/admin-notices
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original Project Code #2
Comments
And, code example to test the above: use WPTRT\AdminNotices\Notices;
add_action( 'admin_notices', function() {
$notices = new Notices();
$notices->add( 'a', 'Info with normal style.', [ 'type' => 'info' ] );
$notices->add( 'b', 'Info with alt style.', [ 'type' => 'info', 'alt_style' => true ] );
$notices->add( 'c', 'Success with normal style.', [ 'type' => 'success' ] );
$notices->add( 'd', 'Success with alt style.', [ 'type' => 'success', 'alt_style' => true ] );
$notices->add( 'e', 'Warning with normal style.', [ 'type' => 'warning' ] );
$notices->add( 'f', 'Warning with alt style.', [ 'type' => 'warning', 'alt_style' => true ] );
$notices->add( 'g', 'Error with normal style.', [ 'type' => 'error' ] );
$notices->add( 'h', 'Error with alt style.', [ 'type' => 'error', 'alt_style' => true ] );
// Display notices.
$notices->display();
// @todo enqueue JS.
} ); |
aristath
added a commit
that referenced
this issue
Sep 8, 2019
Thanks @justintadlock! I took a lot of that code and refactored the package. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I meant to push this live ages ago but forgot. I'm just opening this ticket to share the original code that I threw together. Feel free to use any bits and pieces or discard it altogether. There might be an idea or two worth looking at in there.
admin-notices.zip
The text was updated successfully, but these errors were encountered: