Skip to content

Instantly share code, notes, and snippets.

@codescribblr
Created February 13, 2014 21:41
Show Gist options
  • Save codescribblr/8984435 to your computer and use it in GitHub Desktop.
Save codescribblr/8984435 to your computer and use it in GitHub Desktop.
custom post type custom update message
//add a custom message to the post message function
add_filter('post_updated_messages', 'listing_updated_messages');
function listing_updated_messages( $messages ) {
$messages['listing'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __('Listing updated. <a href="%s">View Listing</a>'), esc_url( get_permalink($post_ID) ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Listing updated.'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('Listing restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('Listing published. <a href="%s">View Listing</a>'), esc_url( get_permalink($post_ID) ) ),
7 => __('Listing saved.'),
8 => sprintf( __('Listing submitted. <a target="_blank" href="%s">Preview Listing</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __('Listing scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Listing</a>'),
// translators: Publish box date format, see http://php.net/date
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __('Listing draft updated. <a target="_blank" href="%s">Preview Listing</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);
return $messages;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment