Advertisement
helgatheviki

Filter bulk messages

Jul 8th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. add_filter( 'bulk_post_updated_messages', 'donation_bulk_messages', 10, 2 );
  2.  
  3. function donation_bulk_messages( $bulk_messages, $bulk_counts ) {
  4.  
  5.     $post_obj = get_post_type_object( 'donation' );
  6.     $singular = strtolower( $post_obj->labels->singular_name );
  7.     $plural = strtolower( $post_obj->labels->name );
  8.  
  9.     $bulk_messages[ 'donation' ] = array(
  10.         'updated'   => _n( "%d $singular updated.", "%d $plural updated.", $bulk_counts['updated'], 'charitable' ),
  11.         'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( "1 $singular not updated, somebody is editing it." ) :
  12.                            _n( "%s $singular not updated, somebody is editing it.", "%s $plural not updated, somebody is editing them.", $bulk_counts['locked'], 'charitable' ),
  13.         'deleted'   => _n( "%s $singular permanently deleted.", "%s $plural permanently deleted.", $bulk_counts['deleted'], 'charitable' ),
  14.         'trashed'   => _n( "%s $singular moved to the Trash.", "%s $plural moved to the Trash.", $bulk_counts['trashed'], 'charitable' ),
  15.         'untrashed' => _n( "%s $singular restored from the Trash.", "%s $plural restored from the Trash.", $bulk_counts['untrashed'], 'charitable' ),
  16.     );
  17.  
  18.     return $bulk_messages;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement