Skip to content

Instantly share code, notes, and snippets.

@kharakhordindemo
Created December 19, 2017 11:54
Show Gist options
  • Save kharakhordindemo/8357e2257664cea83366b7f06704baa0 to your computer and use it in GitHub Desktop.
Save kharakhordindemo/8357e2257664cea83366b7f06704baa0 to your computer and use it in GitHub Desktop.
Custom Taxonomies
<?php
function art_register_taxonomy() {
$singular = 'Location';
$plural = 'Locations';
$labels = array(
'name' => $plural,
'singular_name' => $singular,
'search_items' => 'Search ' . $plural,
'popular_items' => 'Popular ' . $plural,
'all_items' => 'All ' . $plural,
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => 'Edit ' . $singular,
'update_item' => 'Update ' . $singular,
'add_new_item' => 'Add New ' . $singular,
'new_item_name' => 'New ' . $singular . ' Name',
'separate_items_with_commas' => 'Separate ' . $plural . ' with commas',
'add_or_remove_items' => 'Add or remove ' . $plural,
'choose_from_most_used' => 'Choose from the most used ' . $plural,
'not_found' => 'No ' . $plural . ' found.',
'menu_name' => $plural,
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'job' ),
);
register_taxonomy( 'job', 'job_list', $args );
}
add_action( 'init', 'art_register_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment