Advertisement
Guest User

Untitled

a guest
Apr 24th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <?php
  2. add_action( 'init', 'mytheme_create_post_type' );
  3. function mytheme_create_post_type() { // jobs custom post type
  4. // set up labels
  5. $job_labels = array(
  6. 'name' => __( 'Jobs' ),
  7. 'singular_name' => __( 'Job' ),
  8. 'add_new' => __( 'Add New' ),
  9. 'add_new_item' => __( 'Add New Job' ),
  10. 'edit_item' => __( 'Edit Job' ),
  11. 'new_item' => __( 'New Job' ),
  12. 'all_items' => __( 'All Jobs' ),
  13. 'view_item' => __( 'View Job' ),
  14. 'search_items' => __( 'Search Jobs' ),
  15. 'not_found' => __( 'No Jobs Found' ),
  16. 'not_found_in_trash' => __( 'No Jobs found in Trash' ),
  17. 'parent_item' => __( 'Parent Job' ),
  18. 'parent_item_colon' => __( 'Parent Job:' ),
  19. 'menu_name' => __( 'Jobs' ),
  20. );
  21. register_post_type(
  22. 'job',
  23. array(
  24. 'labels' => $job_labels,
  25. 'has_archive' => true,
  26. 'public' => true,
  27. 'hierarchical' => false,
  28. 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail', 'page-attributes' ),
  29. 'taxonomies' => array( 'post_tag', 'job_category' ),
  30. 'exclude_from_search' => true,
  31. 'capability_type' => 'post'
  32. )
  33. );
  34.  
  35. register_taxonomy_for_object_type( 'job_category', 'job' );
  36. }
  37.  
  38. add_action( 'init', 'mytheme_create_taxonomies', 5 );
  39. function mytheme_create_taxonomies() {
  40. // job taxonomy
  41. $job_labels = array(
  42. 'name' => _x( 'Job Categories', 'taxonomy general name' ),
  43. 'singular_name' => _x( 'Job Category', 'taxonomy singular name' ),
  44. 'search_items' => __( 'Search Job Categories' ),
  45. 'all_items' => __( 'All Job Categories' ),
  46. 'parent_item' => __( 'Parent Job Category' ),
  47. 'parent_item_colon' => __( 'Parent Job Category:' ),
  48. 'edit_item' => __( 'Edit Job Category' ),
  49. 'update_item' => __( 'Update Job Category' ),
  50. 'add_new_item' => __( 'Add New Job Category' ),
  51. 'new_item_name' => __( 'New Job Category' ),
  52. 'menu_name' => __( 'Job Categories' ),
  53. );
  54. register_taxonomy(
  55. 'job_category',
  56. 'job',
  57. array(
  58. 'hierarchical' => false,
  59. 'labels' => $job_labels,
  60. 'rewrite' => false,
  61. 'show_admin_column' => true
  62. )
  63. );
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement