Skip to content

Instantly share code, notes, and snippets.

@donini
Last active September 8, 2019 12:17
Show Gist options
  • Save donini/2f48c0a77b6b1e302a66b9bb552e94be to your computer and use it in GitHub Desktop.
Save donini/2f48c0a77b6b1e302a66b9bb552e94be to your computer and use it in GitHub Desktop.
<?php
add_action( 'admin_notices', 'admin_notice__success' );
function admin_notice__success() {
$class = 'notice notice-success is-dismissible';
$message = __( 'Completelly with success!', 'text_domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
add_action( 'admin_notices', 'admin_notice__error' );
function admin_notice__error() {
$class = 'notice notice-error';
$message = __( 'An error has occurred.', 'text_domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment