WordPress.org

Make WordPress Core

Ticket #18368: updated_post_message-css_class.patch

File updated_post_message-css_class.patch, 1.6 KB (added by cgrymala, 7 years ago)

Allows a CSS class to be assigned to an updated post message

  • edit-form-advanced.php

     
    6161$messages = apply_filters( 'post_updated_messages', $messages );
    6262
    6363$message = false;
     64$messageclass = false;
    6465if ( isset($_GET['message']) ) {
    6566        $_GET['message'] = absint( $_GET['message'] );
    66         if ( isset($messages[$post_type][$_GET['message']]) )
    67                 $message = $messages[$post_type][$_GET['message']];
    68         elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
     67        if ( isset($messages[$post_type][$_GET['message']]) ) {
     68                if( is_array( $messages[$post_type][$_GET['message']] ) ) {
     69                        $message = $messages[$post_type][$_GET['message']]['message'];
     70                        $messageclass = $messages[$post_type][$_GET['message']]['class'];
     71                } else {
     72                        $message = $messages[$post_type][$_GET['message']];
     73                }
     74        } elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) {
    6975                $message = $messages['post'][$_GET['message']];
     76        }
    7077}
    7178
    7279$notice = false;
     
    200207<div id="notice" class="error"><p><?php echo $notice ?></p></div>
    201208<?php endif; ?>
    202209<?php if ( $message ) : ?>
    203 <div id="message" class="updated"><p><?php echo $message; ?></p></div>
     210<div id="message" class="<?php echo empty( $messageclass ) ? 'updated' : $messageclass; ?>"><p><?php echo $message; ?></p></div>
    204211<?php endif; ?>
    205212<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>>
    206213<?php wp_nonce_field($nonce_action); ?>