Last active
November 20, 2017 13:50
-
-
Save isuke01/cfff212ced582f91f7d03eca7b839c24 to your computer and use it in GitHub Desktop.
WP_admin simple notice JS
This file contains 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
/** | |
* admin_notice(desc, type, dismissable) | |
* | |
* @param string desc: descriotion text for notice | |
* @param string type: oneof [success, error, warning, info] | |
* @param bool dismissable: should be dismissable or dont | |
*/ | |
function admin_notice(desc, type, dismissable) { | |
if (dismissable) { | |
dismissable = 'is-dismissible'; | |
dismissable_html = '<button onClick="event.target.parentNode.remove()" type="button" class="notice-dismiss">'; | |
} else { | |
dismissable = ''; | |
dismissable_html = ''; | |
} | |
return '<div class="settings-messages"><div class="notice notice-'+type+' '+dismissable+'"><p>'+desc+'</p>'+dismissable_html+'<span class="screen-reader-text">Status notice</span></button></div></div>' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment