Created
August 22, 2017 13:10
-
-
Save lgedeon/0cbadda43a932472e1bcf1d74e0a96d1 to your computer and use it in GitHub Desktop.
Wrong approach maybe some usable pieces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display our notice and hide default. | |
*/ | |
function action_admin_notices() { | |
$screen = get_current_screen(); | |
if ( ! in_array( $screen->id, array( 'post', 'page' ), true ) ) { | |
return; | |
} | |
$post = get_post(); | |
$message = get_post_meta( $post->ID, self::META_KEY, true ); | |
// Add our error message and hide default WP success message. | |
if ( $message ) { ?> | |
<div class="notice notice-error is-dismissible"> | |
<p><?php echo esc_html( $message ); ?></p> | |
</div> | |
<script>jQuery(document).ready(function(jQuery){jQuery('#message.notice-success').hide();});</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment