Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'init', 'mytheme_create_post_type' );
- function mytheme_create_post_type() { // jobs custom post type
- // set up labels
- $job_labels = array(
- 'name' => __( 'Jobs' ),
- 'singular_name' => __( 'Job' ),
- 'add_new' => __( 'Add New' ),
- 'add_new_item' => __( 'Add New Job' ),
- 'edit_item' => __( 'Edit Job' ),
- 'new_item' => __( 'New Job' ),
- 'all_items' => __( 'All Jobs' ),
- 'view_item' => __( 'View Job' ),
- 'search_items' => __( 'Search Jobs' ),
- 'not_found' => __( 'No Jobs Found' ),
- 'not_found_in_trash' => __( 'No Jobs found in Trash' ),
- 'parent_item' => __( 'Parent Job' ),
- 'parent_item_colon' => __( 'Parent Job:' ),
- 'menu_name' => __( 'Jobs' ),
- );
- register_post_type(
- 'job',
- array(
- 'labels' => $job_labels,
- 'has_archive' => true,
- 'public' => true,
- 'hierarchical' => false,
- 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail', 'page-attributes' ),
- 'taxonomies' => array( 'post_tag', 'job_category' ),
- 'exclude_from_search' => true,
- 'capability_type' => 'post'
- )
- );
- register_taxonomy_for_object_type( 'job_category', 'job' );
- }
- add_action( 'init', 'mytheme_create_taxonomies', 5 );
- function mytheme_create_taxonomies() {
- // job taxonomy
- $job_labels = array(
- 'name' => _x( 'Job Categories', 'taxonomy general name' ),
- 'singular_name' => _x( 'Job Category', 'taxonomy singular name' ),
- 'search_items' => __( 'Search 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' ),
- 'menu_name' => __( 'Job Categories' ),
- );
- register_taxonomy(
- 'job_category',
- 'job',
- array(
- 'hierarchical' => false,
- 'labels' => $job_labels,
- 'rewrite' => false,
- 'show_admin_column' => true
- )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement