Posted By

bitsculptor on 10/13/12


Tagged

post wordpress type custom


Versions (?)

custom post type custom update message


 / Published in: PHP
 

This allows you to change the post updated message that wordpress automatically inserts.

  1. //add a custom message to the post message function
  2.  
  3. add_filter('post_updated_messages', 'listing_updated_messages');
  4. function listing_updated_messages( $messages ) {
  5.  
  6. $messages['listing'] = array(
  7. 0 => '', // Unused. Messages start at index 1.
  8. 1 => sprintf( __('Listing updated. <a href="%s">View Listing</a>'), esc_url( get_permalink($post_ID) ) ),
  9. 2 => __('Custom field updated.'),
  10. 3 => __('Custom field deleted.'),
  11. 4 => __('Listing updated.'),
  12. /* translators: %s: date and time of the revision */
  13. 5 => isset($_GET['revision']) ? sprintf( __('Listing restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
  14. 6 => sprintf( __('Listing published. <a href="%s">View Listing</a>'), esc_url( get_permalink($post_ID) ) ),
  15. 7 => __('Listing saved.'),
  16. 8 => sprintf( __('Listing submitted. <a target="_blank" href="%s">Preview Listing</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
  17. 9 => sprintf( __('Listing scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Listing</a>'),
  18. // translators: Publish box date format, see http://php.net/date
  19. date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
  20. 10 => sprintf( __('Listing draft updated. <a target="_blank" href="%s">Preview Listing</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
  21. );
  22.  
  23. return $messages;
  24. }

Report this snippet  

You need to login to post a comment.