Closed grappler closed 9 years ago
That commit has two things in it:
1) Allowing for skipping the prefixing of the ignore key/ and the sub_str()
, which was designed to limit length from getting too long.
meta_key
column. But I guess this is good.2) Adding the is-dismissible
class.
Yes, the commit has multiple things in it. I wanted to commit all of my changes in one branch. We can discuss 1. further in https://github.com/CalderaWP/dismissible_notice/pull/4
The two changesets. https://core.trac.wordpress.org/changeset/32068 https://core.trac.wordpress.org/changeset/31973
This is the JS needed
// Make notices dismissible
$( '.notice.is-dismissible' ).each( function() {
var $this = $( this ),
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
btnText = caldera_commonL10n.dismiss || '';
// Ensure plain text
$button.find( '.screen-reader-text' ).text( btnText );
$this.append( $button );
$button.on( 'click.wp-dismiss-notice', function( event ) {
event.preventDefault();
$this.fadeTo( 100 , 0, function() {
$(this).slideUp( 100, function() {
$(this).remove();
});
});
});
});
This PHP then internationalizes the elements
wp_localize_script( 'caldera-common', 'caldera_commonL10n', array(
'dismiss' => __( 'Dismiss this notice.', 'plugin-domain' ),
) );
I am not sure what CSS changes need to be made.
As long as it works in pre 4.2 I'm OK with that change.
How many WP versions do you want to support? In the current code dashicons are being used which were only added in 3.8. I have been able to test the code for it to work in 3.7.8 but there are no dashicons before 3.8.
Is support till WP 3.8 enough?
In WordPress 4.2 a new class was introduced to add a dismiss button.
I made some changes to switch to using the class
is-dismissible
https://github.com/grappler/dismissible_notice/commit/7ca7b9d50dcd306944abadd471749754c0627a9bI am not sure how you want to support it in this class.