Advertisement
Guest User

Untitled

a guest
Oct 7th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. add_action( 'init', 'dwwp_register_post_type' );
  2.  
  3. function dwwp_register_post_type() {
  4.  
  5. $singular = 'Case Study';
  6. $plural = 'Case Studies';
  7. $slug = str_replace( ' ', '-', strtolower( $singular ) );
  8. $labels = array(
  9. 'name' => $plural,
  10. 'singular_name' => $singular,
  11. 'add_new' => 'Add New',
  12. 'add_new_item' => 'Add New ' . $singular,
  13. 'edit' => 'Edit',
  14. 'edit_item' => 'Edit ' . $singular,
  15. 'new_item' => 'New ' . $singular,
  16. 'view' => 'View ' . $singular,
  17. 'view_item' => 'View ' . $singular,
  18. 'search_term' => 'Search ' . $plural,
  19. 'parent' => 'Parent ' . $singular,
  20. 'not_found' => 'No ' . $plural .' found',
  21. 'not_found_in_trash' => 'No ' . $plural .' in Trash'
  22. );
  23. $args = array(
  24. 'labels' => $labels,
  25. 'public' => true,
  26. 'publicly_queryable' => true,
  27. 'exclude_from_search' => false,
  28. 'show_in_nav_menus' => true,
  29. 'show_ui' => true,
  30. 'show_in_menu' => true,
  31. 'show_in_admin_bar' => true,
  32. 'menu_position' => 10,
  33. 'menu_icon' => 'dashicons-location',
  34. 'can_export' => true,
  35. 'delete_with_user' => false,
  36. 'hierarchical' => false,
  37. 'has_archive' => true,
  38. 'query_var' => true,
  39. 'capability_type' => 'post',
  40. 'map_meta_cap' => true,
  41. // 'capabilities' => array(),
  42. 'rewrite' => array(
  43. 'slug' => $slug,
  44. 'with_front' => true,
  45. 'pages' => true,
  46. 'feeds' => true,
  47. ),
  48. 'supports' => array(
  49. 'title',
  50. 'thumbnail',
  51. 'revisions'
  52. ),
  53. 'taxonomies' => array('post_tag'),
  54. );
  55. register_post_type( $slug, $args);
  56. // flush_rewrite_rules();
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement