Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created January 17, 2017 18:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/6d4981b1d5e9f12faaba253b9f14745e to your computer and use it in GitHub Desktop.
Save westonruter/6d4981b1d5e9f12faaba253b9f14745e to your computer and use it in GitHub Desktop.
Add a notification of each type to each customizer setting: paste this into your console
wp.customize.each( function( setting ) {
var notifications = [
new wp.customize.Notification( 'example-error', { 'message': 'This is an example error.', type: 'error' } ),
new wp.customize.Notification( 'example-warning', { 'message': 'This is an example warning.', type: 'warning' } ),
new wp.customize.Notification( 'example-info', { 'message': 'This is an example info.', type: 'info' } ),
new wp.customize.Notification( 'example-notice', { 'message': 'This is an example notice.', type: 'notice' } ),
];
_.each( notifications, function ( notification ) {
setting.notifications.add( notification.code, notification );
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment