daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /* Custom Post Type für Rezensionen */
  3. add_action( 'init', 'create_post_type' );
  4. function create_post_type() {
  5. $args = array(
  6. 'labels' => post_type_labels( 'Rezension' ),
  7. 'public' => true,
  8. 'publicly_queryable' => true,
  9. 'show_ui' => true,
  10. 'show_in_menu' => true,
  11. 'query_var' => true,
  12. 'rewrite' => true,
  13. 'capability_type' => 'post',
  14. 'has_archive' => true,
  15. 'hierarchical' => false,
  16. 'menu_position' => null,
  17. 'supports' => array('title',
  18. 'editor',
  19. 'author',
  20. 'thumbnail',
  21. 'excerpt',
  22. 'comments'
  23. )
  24. );
  25. register_post_type( 'rezension', $args );
  26. }
  27. // A helper function for generating the labels
  28. function post_type_labels( $singular, $plural = '' )
  29. {
  30. if( $plural == '') $plural = $singular .'en';
  31. return array(
  32. 'name' => _x( $plural, 'post type general name' ),
  33. 'singular_name' => _x( $singular, 'post type singular name' ),
  34. 'add_new' => __( 'Hinzuf&uuml;gen' ),
  35. 'add_new_item' => __( 'Hinzuf&uuml;gen '. $singular ),
  36. 'edit_item' => __( 'Editieren '. $singular ),
  37. 'new_item' => __( 'Neu '. $singular ),
  38. 'view_item' => __( 'Anschauen '. $singular ),
  39. 'search_items' => __( 'Suchen '. $plural ),
  40. 'not_found' => __( 'Kein '. $plural .' gefunden' ),
  41. 'not_found_in_trash' => __( 'Kein '. $plural .' Im Papierkorb gefunden' ),
  42. 'parent_item_colon' => ''
  43. );
  44. }
  45. /* Filter hinzufügen um die richtigen Benachrichtigungen anzuzeigen */
  46. add_filter('post_updated_messages', 'post_type_updated_messages');
  47. function post_type_updated_messages( $messages ) {
  48. global $post, $post_ID;
  49. $messages['rezension'] = array(
  50. 0 => '',
  51. 1 => sprintf( __('Rezension aktualisiert. <a href="%s">anschauen</a>'), esc_url( get_permalink($post_ID) ) ),
  52. 2 => __('Benutzerdefiniertes Feld aktualisiert.'),
  53. 3 => __('Benutzerdefiniertes Feld gel&ouml;scht.'),
  54. 4 => __('Rezension aktualisiert.'),
  55. /* translators: %s: date and time of the revision */
  56. 5 => isset($_GET['revision']) ? sprintf( __('Rezension zur Revision zur&uuml;ckgeholt von %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
  57. 6 => sprintf( __('Rezension ver&ouml;ffentlicht. <a href="%s">anschauen</a>'), esc_url( get_permalink($post_ID) ) ),
  58. 7 => __('Rezension gespeichert.'),
  59. 8 => sprintf( __('Rezension &uuml;bermittelt. <a target="_blank" href="%s">Vorabversion anschauen</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
  60. 9 => sprintf( __('Rezensin aufgeschoben f&uuml;r: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Vorabversion anschauen</a>'),
  61. // translators: Publish box date format, see php.net/date
  62. date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
  63. 10 => sprintf( __('Rezensionsvorschlag aktualisiert. <a target="_blank" href="%s">Vorabversion anschauen</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
  64. );
  65. return $messages;
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top