Advertisement
Guest User

Custom Post Types

a guest
Jul 17th, 2021
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. function cptui_register_my_cpts_testimonials() {
  2.  
  3. /**
  4. * Post Type: Testimonials.
  5. */
  6.  
  7. $labels = [
  8. "name" => __( "Testimonials", "customtheme" ),
  9. "singular_name" => __( "Testimonial", "customtheme" ),
  10. "menu_name" => __( "Testimonials", "customtheme" ),
  11. "all_items" => __( "All Testimonials", "customtheme" ),
  12. "add_new" => __( "Add new", "customtheme" ),
  13. "add_new_item" => __( "Add new Testimonial", "customtheme" ),
  14. "edit_item" => __( "Edit Testimonial", "customtheme" ),
  15. "new_item" => __( "New Testimonial", "customtheme" ),
  16. "view_item" => __( "View Testimonial", "customtheme" ),
  17. "view_items" => __( "View Testimonials", "customtheme" ),
  18. "search_items" => __( "Search Testimonials", "customtheme" ),
  19. "not_found" => __( "No Testimonials found", "customtheme" ),
  20. "not_found_in_trash" => __( "No Testimonials found in trash", "customtheme" ),
  21. "parent" => __( "Parent Testimonials:", "customtheme" ),
  22. "featured_image" => __( "Featured image for this Testimonial", "customtheme" ),
  23. "set_featured_image" => __( "Set featured image for this Testimonial", "customtheme" ),
  24. "remove_featured_image" => __( "Remove featured image for this Testimonial", "customtheme" ),
  25. "use_featured_image" => __( "Use as featured image for this Testimonial", "customtheme" ),
  26. "archives" => __( "Testimonial archives", "customtheme" ),
  27. "insert_into_item" => __( "Insert into Testimonial", "customtheme" ),
  28. "uploaded_to_this_item" => __( "Upload to this Testimonial", "customtheme" ),
  29. "filter_items_list" => __( "Filter Testimonials list", "customtheme" ),
  30. "items_list_navigation" => __( "Testimonials list navigation", "customtheme" ),
  31. "items_list" => __( "Testimonials list", "customtheme" ),
  32. "attributes" => __( "Testimonial attributes", "customtheme" ),
  33. "name_admin_bar" => __( "Testimonial", "customtheme" ),
  34. "item_published" => __( "Testimonials published", "customtheme" ),
  35. "item_published_privately" => __( "Testimonial published privately.", "customtheme" ),
  36. "item_reverted_to_draft" => __( "Testimonial reverted to draft.", "customtheme" ),
  37. "item_scheduled" => __( "Testimonial scheduled", "customtheme" ),
  38. "item_updated" => __( "Testimonial updated.", "customtheme" ),
  39. "parent_item_colon" => __( "Parent Testimonials:", "customtheme" ),
  40. ];
  41.  
  42. $args = [
  43. "label" => __( "Testimonials", "customtheme" ),
  44. "labels" => $labels,
  45. "description" => "Testimonial Posts",
  46. "public" => true,
  47. "publicly_queryable" => true,
  48. "show_ui" => true,
  49. "show_in_rest" => false,
  50. "rest_base" => "",
  51. "rest_controller_class" => "WP_REST_Posts_Controller",
  52. "has_archive" => "testimonials",
  53. "show_in_menu" => true,
  54. "show_in_nav_menus" => true,
  55. "delete_with_user" => false,
  56. "exclude_from_search" => false,
  57. "capability_type" => "post",
  58. "map_meta_cap" => true,
  59. "hierarchical" => false,
  60. "rewrite" => [ "slug" => "testimonials", "with_front" => true ],
  61. "query_var" => true,
  62. "menu_position" => 9,
  63. "menu_icon" => "dashicons-testimonial",
  64. "supports" => [ "title", "editor", "thumbnail" ],
  65. "show_in_graphql" => false,
  66. ];
  67.  
  68. register_post_type( "testimonials", $args );
  69. }
  70.  
  71. add_action( 'init', 'cptui_register_my_cpts_testimonials' );
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement