Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. add_action( 'init', 'add_post_type_event' );
  2. function add_post_type_event() {
  3. flush_rewrite_rules( false );
  4.     register_post_type( 'd3ms4_event',
  5.         array(
  6.             'labels' => array(
  7.                 'name' => __( 'Events' ),
  8.                 'singular_name' => __( 'Events' ),
  9.                 'add_new' => __( 'Add New Event' ),
  10.                 'add_new_item' => __( 'Add New Event' ),
  11.                 'edit_item' => __( 'Edit Event' ),
  12.                 'new_item' => __( 'Add New Event' ),
  13.                 'view_item' => __( 'View Event' ),
  14.                 'search_items' => __( 'Search Event' ),
  15.                 'not_found' => __( 'No event found' ),
  16.                 'not_found_in_trash' => __( 'No event found in trash' )
  17.                 ),
  18.             'public' => true,  // it's not public, it shouldn't have it's own permalink, and so on
  19.             'publicly_queriable' => true,  // you should be able to query it
  20.             'show_ui' => true,  // you should be able to edit it in wp-admin
  21.             'exclude_from_search' => true,  // you should exclude it from search results
  22.             'show_in_nav_menus' => true,  // you shouldn't be able to add it to menus
  23.             'has_archive' => true,  // it shouldn't have archive page
  24.             'rewrite' => array( 'slug' => 'event' ),  // it shouldn't have rewrite rules
  25.             'supports' => array('title', 'editor', 'thumbnail'),
  26.             'capability_type' => 'post',
  27.             'menu_icon'   => 'dashicons-calendar-alt',
  28.             'menu_position' => 5
  29.             )
  30.         );
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement