Skip to content

Instantly share code, notes, and snippets.

Created June 11, 2013 09:24
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 anonymous/5755598 to your computer and use it in GitHub Desktop.
Save anonymous/5755598 to your computer and use it in GitHub Desktop.
custom taxonomy for classifieds
<?php
/****Creating Custom Taxonomies for Classifieds *****/
function my_taxonomies_classified_category() {
$labels = array(
'name' => _x( 'Classified Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Classified Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Classified Categories' ),
'all_items' => __( 'All Classified Categories' ),
'parent_item' => __( 'Parent Classified Category' ),
'parent_item_colon' => __( 'Parent Classified Category:' ),
'edit_item' => __( 'Edit Classified Category' ),
'update_item' => __( 'Update Classified Category' ),
'add_new_item' => __( 'Add New Classified Category' ),
'new_item_name' => __( 'New Classified Category' ),
'menu_name' => __( 'Classified Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'classifieds-category' ),
);
register_taxonomy( 'classified_category', 'classifieds', $args );
}
add_action( 'init', 'my_taxonomies_classified_category', 0 );
function my_taxonomies_classified_tag() {
$labels = array(
'name' => _x( 'Classified Tags', 'taxonomy general name' ),
'singular_name' => _x( 'Classified Tag', 'taxonomy singular name' ),
'search_items' => __( 'Search Classified Tags' ),
'all_items' => __( 'All Classified Tags' ),
'parent_item' => __( 'Parent Classified Tag' ),
'parent_item_colon' => __( 'Parent Classified Tag:' ),
'edit_item' => __( 'Edit Classified Tag' ),
'update_item' => __( 'Update Classified Tag' ),
'add_new_item' => __( 'Add New Classified Tag' ),
'new_item_name' => __( 'New Classified Tag' ),
'menu_name' => __( 'Classified Tags' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'rewrite' => array( 'slug' => 'classifieds-tag' ),
);
register_taxonomy( 'classified_tag', 'classifieds', $args );
}
add_action( 'init', 'my_taxonomies_classified_tag', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment