Skip to content

Instantly share code, notes, and snippets.

@faaezahmd
Created February 15, 2022 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faaezahmd/2dc0c99e2812789ae540a05f15a90dbf to your computer and use it in GitHub Desktop.
Save faaezahmd/2dc0c99e2812789ae540a05f15a90dbf to your computer and use it in GitHub Desktop.
// Lets us create Taxonomy for Custom Post Type
add_action( 'init', 'jobs_custom_taxonomy', 0 );
//create a custom taxonomy name it "type" for your posts
function jobs_custom_taxonomy() {
$labels = array(
'name' => _x( 'Types', 'taxonomy general name' ),
'singular_name' => _x( 'Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Types' ),
'all_items' => __( 'All Types' ),
'parent_item' => __( 'Parent Type' ),
'parent_item_colon' => __( 'Parent Type:' ),
'edit_item' => __( 'Edit Type' ),
'update_item' => __( 'Update Type' ),
'add_new_item' => __( 'Add New Type' ),
'new_item_name' => __( 'New Type Name' ),
'menu_name' => __( 'Types' ),
);
register_taxonomy('types',array('jobs'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'job' ),
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment