What's Changed
Greatly improved custom notice designs
In #9 the method for creating custom notices was overhauled. Previously, there were methods for adding and removing "wrappers", however this was confusing and problematic. The main problem was that the way notices were positioned ended up still applying default WP styles, which the notice then had to fight. The wrapper concept was dropped entirely, replaced with two methods:
AdminNotice::custom()
— tells the system this is a custom notice, which omits all standard styles and applies the necessary attributes to the custom markup providedAdminNotice::location()
— positions the notice on the page, using our own JS instead of relying on WP to position it. Note, by default the location is the standard notice location.
Conditionally enqueued scripts and stylesheets
In #10, we introduced a way for a notice to have a single script and stylesheet attached to it, such that those are loaded on the page only if the notice is set to display. This is handy as it takes all the fancy conditions this library introduced into consideration, avoiding unnecessary scripts and stylesheets.
AdminNotice::enqueueScript()
— adds a JS script to be included when the notice displaysAdminNotice::enqueueStylesheet
— adds a CSS stylesheet to be included when the notice displays
More information on all the new methods can be found in the updated README.
Breaking Changes
As mentioned, version 1.x used the idea of "wrappers" and such for trying to make custom notices. If you used the wrapper methods, this will break for you. You will need to update to using the new custom notice methods as part of updating.
Note: Standard notices should continue to work just fine and should be backwards-compatible.
Full Changelog: 1.2.2...2.0.0