Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. function cptui_register_my_cpts_listing() {
  2.  
  3. /**
  4. * Post Type: Listing.
  5. */
  6.  
  7. $labels = array(
  8. "name" => __( "Listing", "sage" ),
  9. );
  10.  
  11. $args = array(
  12. "label" => __( "Listing", "sage" ),
  13. "labels" => $labels,
  14. "description" => "New Listinga",
  15. "public" => true,
  16. "publicly_queryable" => true,
  17. "show_ui" => true,
  18. "delete_with_user" => false,
  19. "show_in_rest" => true,
  20. "rest_base" => "",
  21. "rest_controller_class" => "WP_REST_Posts_Controller",
  22. "has_archive" => true,
  23. "show_in_menu" => true,
  24. "show_in_nav_menus" => true,
  25. "exclude_from_search" => false,
  26. "capability_type" => "post",
  27. "map_meta_cap" => true,
  28. "hierarchical" => true,
  29. "rewrite" => array( "slug" => "/%club_type%/", "with_front" => false ),
  30. "query_var" => true,
  31. "supports" => array( "title", "editor" ),
  32. "taxonomies" => array( "club_type", "city_part" ),
  33. );
  34.  
  35. register_post_type( "listing", $args );
  36. }
  37.  
  38. add_action( 'init', 'cptui_register_my_cpts_listing' );
  39.  
  40. function cptui_register_my_taxes_club_type() {
  41.  
  42. /**
  43. * Taxonomy: Club Type
  44. */
  45.  
  46. $labels = array(
  47. "name" => __( "club_type", "sage" ),
  48. "singular_name" => __( "club_type", "sage" ),
  49. );
  50.  
  51. $args = array(
  52. "label" => __( "club_type", "bgn" ),
  53. "labels" => $labels,
  54. "public" => true,
  55. "publicly_queryable" => true,
  56. "hierarchical" => true,
  57. "show_ui" => true,
  58. "show_in_menu" => true,
  59. "show_in_nav_menus" => true,
  60. "query_var" => true,
  61. "rewrite" => array( 'slug' => 'club_type', 'with_front' => false, ),
  62. "show_admin_column" => true,
  63. "show_in_rest" => true,
  64. "rest_base" => "club_type",
  65. "rest_controller_class" => "WP_REST_Terms_Controller",
  66. "show_in_quick_edit" => true,
  67. );
  68. register_taxonomy( "club_type", array( "listing" ), $args );
  69. }
  70. add_action( 'init', 'cptui_register_my_taxes_club_type' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement