kalponikoronno

register post type

Dec 17th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. <?php
  2. // Register Custom Post Type
  3. function publication_post_type() {
  4.  
  5.     $labels = array(
  6.             'name'                => _x( 'Veröffentlichungen', 'Post Type General Name', 'text_domain' ),
  7.             'singular_name'       => _x( 'Veröffentlichung', 'Post Type Singular Name', 'text_domain' ),
  8.             'menu_name'           => __( 'Veröffentlich.', 'text_domain' ),
  9.             'parent_item_colon'   => __( 'Parent Product:', 'text_domain' ),
  10.             'all_items'           => __( 'Alle Veröffentlichungen', 'text_domain' ),
  11.             'view_item'           => __( 'Veröffentlichungen ansehen', 'text_domain' ),
  12.             'add_new_item'        => __( 'Neue Veröffentlichung', 'text_domain' ),
  13.             'add_new'             => __( 'Veröffentlichung hinzufügen', 'text_domain' ),
  14.             'edit_item'           => __( 'Veröffentlichung bearbeiten', 'text_domain' ),
  15.             'update_item'         => __( 'Veröffentlichung aktualisieren', 'text_domain' ),
  16.             'search_items'        => __( 'Veröffentlichung suchen', 'text_domain' ),
  17.             'not_found'           => __( 'keine Veröffentlichung gefunden', 'text_domain' ),
  18.             'not_found_in_trash'  => __( 'keine Veröffentlichungen im Papierkorb gefunden', 'text_domain' ),
  19.     );
  20.     $rewrite = array(
  21.         'slug'                => 'veroeffentlichungen',
  22.         'with_front'          => false,
  23.         'pages'               => true,
  24.         'feeds'               => false,
  25.     );
  26.  
  27.     $args = array(
  28.             'label'               => __( 'publication', 'text_domain' ),
  29.             'description'         => __( 'Veröffentlichungen', 'text_domain' ),
  30.             'labels'              => $labels,
  31.             'supports'            => array( 'title', ),
  32.             'taxonomies'          => array( 'category', 'post_tag' ),
  33.             'hierarchical'        => false,
  34.             'public'              => true,
  35.             'show_ui'             => true,
  36.             'show_in_menu'        => true,
  37.             'show_in_nav_menus'   => true,
  38.             'show_in_admin_bar'   => true,
  39.             'menu_position'       => 5,
  40.             'can_export'          => true,
  41.             'has_archive'         => true,
  42.             'exclude_from_search' => false,
  43.             'publicly_queryable'  => true,
  44.             'capability_type'     => 'post',
  45.     );
  46.     register_post_type( 'publication', $args );
  47.  
  48. }
  49.  
  50. // Hook into the 'init' action
  51. add_action( 'init', 'publication_post_type', 0 );
  52.  
  53.  
  54. codex example
  55. http://codex.wordpress.org/Function_Reference/register_post_type
Advertisement
Add Comment
Please, Sign In to add comment