Skip to content
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

Closed
justintadlock opened this issue Sep 7, 2019 · 2 comments

Comments

@justintadlock
Copy link
Collaborator

commented Sep 7, 2019

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

@justintadlock

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 7, 2019

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
@aristath

This comment has been minimized.

Copy link
Member

commented Sep 8, 2019

Thanks @justintadlock!

I took a lot of that code and refactored the package.
It is now a mix of the two implementations, details are in the readme file.

@aristath aristath closed this Sep 8, 2019
@aristath aristath referenced this issue Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.