custom-post-type.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <?php
  2. // Register Faculty Post Type
  3. function uiu_cpt_faculty()
  4. {
  5. $labels = array(
  6. 'name' => 'Faculties',
  7. 'singular_name' => 'Faculty',
  8. 'menu_name' => 'Faculties',
  9. 'name_admin_bar' => 'Post Type',
  10. 'archives' => 'Faculty Archives',
  11. 'attributes' => 'Faculty Attributes',
  12. 'parent_item_colon' => 'Parent Faculty:',
  13. 'all_items' => 'All Faculties',
  14. 'add_new_item' => 'Add New Faculty',
  15. 'add_new' => 'Add New',
  16. 'new_item' => 'New Faculty',
  17. 'edit_item' => 'Edit Faculty',
  18. 'update_item' => 'Update Faculty',
  19. 'view_item' => 'View Faculty',
  20. 'view_items' => 'View Faculties',
  21. 'search_items' => 'Search Faculty',
  22. 'featured_image' => 'Cover Image',
  23. 'set_featured_image' => 'Set cover image',
  24. 'remove_featured_image' => 'Remove cover image',
  25. 'use_featured_image' => 'Use as cover image',
  26. 'insert_into_item' => 'Insert into faculty',
  27. 'uploaded_to_this_item' => 'Uploaded to this faculty',
  28. 'items_list' => 'Faculties list',
  29. 'items_list_navigation' => 'Faculties list navigation',
  30. 'filter_items_list' => 'Filter faculties list',
  31. );
  32. $rewrite = array(
  33. 'slug' => 'faculty',
  34. 'with_front' => true,
  35. 'pages' => true,
  36. 'feeds' => true,
  37. );
  38. $args = array(
  39. 'label' => 'Faculty',
  40. 'description' => 'Faculty of Department of CSE',
  41. 'labels' => $labels,
  42. 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
  43. // 'taxonomies' => array('category', 'post_tag'),
  44. 'hierarchical' => false,
  45. 'public' => true,
  46. 'show_ui' => true,
  47. 'show_in_menu' => true,
  48. 'menu_position' => 11,
  49. 'menu_icon' => 'dashicons-businessperson',
  50. 'show_in_admin_bar' => true,
  51. 'show_in_nav_menus' => true,
  52. 'can_export' => true,
  53. 'has_archive' => true,
  54. 'exclude_from_search' => false,
  55. 'publicly_queryable' => true,
  56. 'rewrite' => $rewrite,
  57. 'capability_type' => 'post',
  58. 'show_in_rest' => true,
  59. );
  60. register_post_type('faculty', $args);
  61. }
  62. add_action('init', 'uiu_cpt_faculty', 0);
  63. // Register Success Story Post Type
  64. function uiu_cpt_story()
  65. {
  66. $labels = array(
  67. 'name' => 'Success Stories',
  68. 'singular_name' => 'Success Story',
  69. 'menu_name' => 'Success Stories',
  70. 'name_admin_bar' => 'Post Type',
  71. 'archives' => 'Success Story Archives',
  72. 'attributes' => 'Success Story Attributes',
  73. 'parent_item_colon' => 'Parent Story:',
  74. 'all_items' => 'All Stories',
  75. 'add_new_item' => 'Add New Story',
  76. 'add_new' => 'Add New',
  77. 'new_item' => 'New Story',
  78. 'edit_item' => 'Edit Story',
  79. 'update_item' => 'Update Story',
  80. 'view_item' => 'View Story',
  81. 'view_items' => 'View Stories',
  82. 'search_items' => 'Search Story',
  83. 'featured_image' => 'Cover Image',
  84. 'set_featured_image' => 'Set cover image',
  85. 'remove_featured_image' => 'Remove cover image',
  86. 'use_featured_image' => 'Use as cover image',
  87. 'insert_into_item' => 'Insert into story',
  88. 'uploaded_to_this_item' => 'Uploaded to this story',
  89. 'items_list' => 'Success Stories list',
  90. 'items_list_navigation' => 'Success Stories list navigation',
  91. 'filter_items_list' => 'Filter storys list',
  92. );
  93. $rewrite = array(
  94. 'slug' => 'success_story',
  95. 'with_front' => true,
  96. 'pages' => true,
  97. 'feeds' => true,
  98. );
  99. $args = array(
  100. 'label' => 'Success Story',
  101. 'description' => 'Success Story of Department of CSE',
  102. 'labels' => $labels,
  103. 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
  104. // 'taxonomies' => array('category', 'post_tag'),
  105. 'hierarchical' => false,
  106. 'public' => true,
  107. 'show_ui' => true,
  108. 'show_in_menu' => true,
  109. 'menu_position' => 12,
  110. 'menu_icon' => 'dashicons-businessperson',
  111. 'show_in_admin_bar' => true,
  112. 'show_in_nav_menus' => true,
  113. 'can_export' => true,
  114. 'has_archive' => true,
  115. 'exclude_from_search' => false,
  116. 'publicly_queryable' => true,
  117. 'rewrite' => $rewrite,
  118. 'capability_type' => 'post',
  119. 'show_in_rest' => true,
  120. );
  121. register_post_type('success_story', $args);
  122. }
  123. add_action('init', 'uiu_cpt_story', 0);
  124. // Register Alumnus Post Type
  125. function uiu_cpt_alumni()
  126. {
  127. $labels = array(
  128. 'name' => 'Alumni',
  129. 'singular_name' => 'Alumnus',
  130. 'menu_name' => 'Alumni',
  131. 'name_admin_bar' => 'Post Type',
  132. 'archives' => 'Alumnus Archives',
  133. 'attributes' => 'Alumnus Attributes',
  134. 'parent_item_colon' => 'Parent Alumnus:',
  135. 'all_items' => 'All Alumni',
  136. 'add_new_item' => 'Add New Alumnus',
  137. 'add_new' => 'Add New',
  138. 'new_item' => 'New Alumnus',
  139. 'edit_item' => 'Edit Alumnus',
  140. 'update_item' => 'Update Alumnus',
  141. 'view_item' => 'View Alumnus',
  142. 'view_items' => 'View Alumni',
  143. 'search_items' => 'Search Alumnus',
  144. 'featured_image' => 'Cover Image',
  145. 'set_featured_image' => 'Set cover image',
  146. 'remove_featured_image' => 'Remove cover image',
  147. 'use_featured_image' => 'Use as cover image',
  148. 'insert_into_item' => 'Insert into alumnus',
  149. 'uploaded_to_this_item' => 'Uploaded to this alumnus',
  150. 'items_list' => 'Alumni list',
  151. 'items_list_navigation' => 'Alumni list navigation',
  152. 'filter_items_list' => 'Filter alumni list',
  153. );
  154. $rewrite = array(
  155. 'slug' => 'alumni',
  156. 'with_front' => true,
  157. 'pages' => true,
  158. 'feeds' => true,
  159. );
  160. $args = array(
  161. 'label' => 'Alumnus',
  162. 'description' => 'Alumnus of Department of CSE',
  163. 'labels' => $labels,
  164. 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
  165. // 'taxonomies' => array('category', 'post_tag'),
  166. 'hierarchical' => false,
  167. 'public' => true,
  168. 'show_ui' => true,
  169. 'show_in_menu' => true,
  170. 'menu_position' => 13,
  171. 'menu_icon' => 'dashicons-businessperson',
  172. 'show_in_admin_bar' => true,
  173. 'show_in_nav_menus' => true,
  174. 'can_export' => true,
  175. 'has_archive' => true,
  176. 'exclude_from_search' => false,
  177. 'publicly_queryable' => true,
  178. 'rewrite' => $rewrite,
  179. 'capability_type' => 'post',
  180. 'show_in_rest' => true,
  181. );
  182. register_post_type('alumni', $args);
  183. }
  184. add_action('init', 'uiu_cpt_alumni', 0);
  185. // Register Notice Post Type
  186. function uiu_cpt_notice()
  187. {
  188. $labels = array(
  189. 'name' => 'Notices',
  190. 'singular_name' => 'Notice',
  191. 'menu_name' => 'Notices',
  192. 'name_admin_bar' => 'Post Type',
  193. 'archives' => 'Notice Archives',
  194. 'attributes' => 'Notice Attributes',
  195. 'parent_item_colon' => 'Parent Notice:',
  196. 'all_items' => 'All Notices',
  197. 'add_new_item' => 'Add New Notice',
  198. 'add_new' => 'Add New',
  199. 'new_item' => 'New Notice',
  200. 'edit_item' => 'Edit Notice',
  201. 'update_item' => 'Update Notice',
  202. 'view_item' => 'View Notice',
  203. 'view_items' => 'View Notices',
  204. 'search_items' => 'Search Notice',
  205. 'insert_into_item' => 'Insert into notice',
  206. 'uploaded_to_this_item' => 'Uploaded to this notice',
  207. 'items_list' => 'Notices list',
  208. 'items_list_navigation' => 'Notices list navigation',
  209. 'filter_items_list' => 'Filter notices list',
  210. );
  211. $rewrite = array(
  212. 'slug' => 'notice',
  213. 'with_front' => true,
  214. 'pages' => true,
  215. 'feeds' => true,
  216. );
  217. $args = array(
  218. 'label' => 'Notice',
  219. 'description' => 'Notice of Department of CSE',
  220. 'labels' => $labels,
  221. 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
  222. // 'taxonomies' => array('category', 'post_tag'),
  223. 'hierarchical' => false,
  224. 'public' => true,
  225. 'show_ui' => true,
  226. 'show_in_menu' => true,
  227. 'menu_position' => 14,
  228. 'menu_icon' => 'dashicons-businessperson',
  229. 'show_in_admin_bar' => true,
  230. 'show_in_nav_menus' => true,
  231. 'can_export' => true,
  232. 'has_archive' => true,
  233. 'exclude_from_search' => false,
  234. 'publicly_queryable' => true,
  235. 'rewrite' => $rewrite,
  236. 'capability_type' => 'post',
  237. 'show_in_rest' => true,
  238. );
  239. register_post_type('notice', $args);
  240. }
  241. add_action('init', 'uiu_cpt_notice', 0);
  242. // Register Event Post Type
  243. function uiu_cpt_event()
  244. {
  245. $labels = array(
  246. 'name' => 'Events',
  247. 'singular_name' => 'Event',
  248. 'menu_name' => 'Events',
  249. 'name_admin_bar' => 'Post Type',
  250. 'archives' => 'Event Archives',
  251. 'attributes' => 'Event Attributes',
  252. 'parent_item_colon' => 'Parent Event:',
  253. 'all_items' => 'All Events',
  254. 'add_new_item' => 'Add New Event',
  255. 'add_new' => 'Add New',
  256. 'new_item' => 'New Event',
  257. 'edit_item' => 'Edit Event',
  258. 'update_item' => 'Update Event',
  259. 'view_item' => 'View Event',
  260. 'view_items' => 'View Events',
  261. 'search_items' => 'Search Event',
  262. 'insert_into_item' => 'Insert into event',
  263. 'uploaded_to_this_item' => 'Uploaded to this event',
  264. 'items_list' => 'Events list',
  265. 'items_list_navigation' => 'Events list navigation',
  266. 'filter_items_list' => 'Filter events list',
  267. );
  268. $rewrite = array(
  269. 'slug' => 'event',
  270. 'with_front' => true,
  271. 'pages' => true,
  272. 'feeds' => true,
  273. );
  274. $args = array(
  275. 'label' => 'Event',
  276. 'description' => 'Event of Department of CSE',
  277. 'labels' => $labels,
  278. 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
  279. // 'taxonomies' => array('category', 'post_tag'),
  280. 'hierarchical' => false,
  281. 'public' => true,
  282. 'show_ui' => true,
  283. 'show_in_menu' => true,
  284. 'menu_position' => 15,
  285. 'menu_icon' => 'dashicons-businessperson',
  286. 'show_in_admin_bar' => true,
  287. 'show_in_nav_menus' => true,
  288. 'can_export' => true,
  289. 'has_archive' => true,
  290. 'exclude_from_search' => false,
  291. 'publicly_queryable' => true,
  292. 'rewrite' => $rewrite,
  293. 'capability_type' => 'post',
  294. 'show_in_rest' => true,
  295. );
  296. register_post_type('event', $args);
  297. }
  298. add_action('init', 'uiu_cpt_event', 0);
  299. // Register News Post Type
  300. function uiu_cpt_news()
  301. {
  302. $labels = array(
  303. 'name' => 'News',
  304. 'singular_name' => 'News',
  305. 'menu_name' => 'News',
  306. 'name_admin_bar' => 'Post Type',
  307. 'archives' => 'News Archives',
  308. 'attributes' => 'News Attributes',
  309. 'parent_item_colon' => 'Parent News:',
  310. 'all_items' => 'All News',
  311. 'add_new_item' => 'Add New News',
  312. 'add_new' => 'Add New',
  313. 'new_item' => 'New News',
  314. 'edit_item' => 'Edit News',
  315. 'update_item' => 'Update News',
  316. 'view_item' => 'View News',
  317. 'view_items' => 'View News',
  318. 'search_items' => 'Search News',
  319. 'insert_into_item' => 'Insert into news',
  320. 'uploaded_to_this_item' => 'Uploaded to this news',
  321. 'items_list' => 'News list',
  322. 'items_list_navigation' => 'News list navigation',
  323. 'filter_items_list' => 'Filter news list',
  324. );
  325. $rewrite = array(
  326. 'slug' => 'news',
  327. 'with_front' => true,
  328. 'pages' => true,
  329. 'feeds' => true,
  330. );
  331. $args = array(
  332. 'label' => 'News',
  333. 'description' => 'News of Department of CSE',
  334. 'labels' => $labels,
  335. 'supports' => array('title', 'editor', 'thumbnail', 'author', 'excerpt', 'revisions'),
  336. // 'taxonomies' => array('category', 'post_tag'),
  337. 'hierarchical' => false,
  338. 'public' => true,
  339. 'show_ui' => true,
  340. 'show_in_menu' => true,
  341. 'menu_position' => 16,
  342. 'menu_icon' => 'dashicons-businessperson',
  343. 'show_in_admin_bar' => true,
  344. 'show_in_nav_menus' => true,
  345. 'can_export' => true,
  346. 'has_archive' => true,
  347. 'exclude_from_search' => false,
  348. 'publicly_queryable' => true,
  349. 'rewrite' => $rewrite,
  350. 'capability_type' => 'post',
  351. 'show_in_rest' => true,
  352. );
  353. register_post_type('news', $args);
  354. }
  355. add_action('init', 'uiu_cpt_news', 0);
  356. // $existing_CPT_menu = 'edit.php?post_type=notice';
  357. // $link_our_new_CPT = 'edit.php?post_type=news';
  358. // add_submenu_page($existing_CPT_menu, 'SubmenuTitle', 'SubmenuTitle', 'manage_options', $link_our_new_CPT);
  359. // // functions.php
  360. // add_action('admin_menu', function () {
  361. // add_menu_page(
  362. // 'Custom Admin Page',
  363. // 'Custom Admin Page',
  364. // 'manage_options',
  365. // 'faculty',
  366. // );
  367. // });