Created
February 27, 2011 02:30
-
-
Save joshhartman/845851 to your computer and use it in GitHub Desktop.
WordPress 3.1 Job Opportunities Custom Post Type & Taxonomy Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_post_type('job-opportunities', array( | |
'labels' => array( | |
'name' => 'Job Opportunities', | |
'singular_name' => 'Job Opportunity', | |
'add_new' => 'Add New Job', | |
'add_new_item' => 'Add New Job Opportunity', | |
'edit_item' => 'Edit Job', | |
'new_item' => 'New Job Opportunity', | |
'view_item' => 'View Job', | |
'search_items' => 'Search Job Opportunities', | |
'not_found' => 'No jobs found', | |
'not_found_in_trash' => 'No jobs found in Trash', | |
'parent_item_colon' => 'Parent Job:' | |
), | |
'description' => '', | |
'publicly_queryable' => true, | |
'exclude_from_search' => false, | |
'map_meta_cap'=> true, | |
'capability_type' => 'post', | |
'public' => true, | |
'hierarchical' => false, | |
'rewrite' => array( | |
'slug' => 'work/job-opportunities', | |
'with_front' => true, | |
'pages' => true, | |
'feeds' => 'work/job-opportunities' | |
), | |
'has_archive' => 'work/job-opportunities', | |
'query_var' => '', | |
'supports' => array('title', 'editor'), | |
'taxonomies' => array('job-categories'), | |
'show_ui' => true, | |
'menu_position' => 25, | |
'menu_icon' => '', | |
'can_export' => true, | |
'show_in_nav_menus'=> true, | |
'show_in_menu'=> true | |
) | |
); | |
register_taxonomy( 'job-categories', array('job-opportunities'), | |
array( | |
'hierarchical' => true, | |
'rewrite' => array('slug' => 'work/job-categories'), | |
'query_var' => '', | |
'public' => true, | |
'show_ui' => true, | |
'show_tagcloud' => true, | |
'labels' => array( | |
'name' => 'Job Categories', | |
'singular_name' => 'Job Category', | |
'search_items' => 'Search Job Categories', | |
'popular_items' => 'Popular Job Categories', | |
'all_items' => 'All Job Categories', | |
'parent_item' => 'Parent Job Category', | |
'parent_item_colon' => 'Parent Job Category:', | |
'edit_item' => 'Edit Job Category', | |
'update_item' => 'Update Job Category', | |
'add_new_item' => 'Add New Job Category', | |
'new_item_name' => 'New Job Category Name', | |
'separate_items_with_commas' => 'Separate job categories with commas', | |
'add_or_remove_items' => 'Add or remove job categories', | |
'choose_from_most_used' => 'Choose from the most used job categories' | |
), | |
'capabilities' => array( | |
'manage_terms' => 'manage_categories', | |
'edit_terms' => 'manage_categories', | |
'delete_terms' => 'manage_categories', | |
'assign_terms' => 'edit_posts' | |
), | |
'show_in_nav_menus' => true | |
) | |
); | |
/* | |
// Preload taxonomy with some common terms | |
$job_category_preload_terms = array( | |
'Automotive', | |
'Accounting', | |
'Clerical', | |
'Banking', | |
'Retail', | |
'Sales', | |
'Marketing', | |
'Media', | |
'Secretarial', | |
'Full Time', | |
'Part Time' | |
); | |
foreach($job_category_preload_terms as $job_category_term){ | |
wp_insert_term($job_category_term, 'job-categories'); | |
} | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment