I've spent hours trying to understand the custom taxonomies functionality, but still can't figure out how to use it for my situation.
I have Restaurants. They can be a certain type of restaurant, and can be in a certain city. A restaurant can be more than one type but will not be in more than one city. I need to be able to display a list of restaurants by type, and then list them according to the city they're on.
Basically: Chinese Restaurants page, and on that page is a list of cities, under each city is a list of Restaurant names with a link to their page. This particular restaurant can also appear in the Buffet Restaurants page etc.
Any recommendations on the best way to set up a custom post type and custom taxonomies for this? Right now I have the restaurant post type, and restaurant type as the labels..... but after that I'm not sure where to go. How can I add cities to each of these, and then be able to list each one according to the city? This is what I have so far:
add_action('init', 'rest_register');
function rest_register() {
$labels = array(
'name' => _x('Restaurants', 'post type general name'),
'singular_name' => _x('Restaurant Type', 'post type singular name'),
'add_new' => _x('Add New', 'restaurant type'),
'add_new_item' => __('Add New Restaurant Type'),
'edit_item' => __('Edit Restaurant Type'),
'new_item' => __('New Restaurant Type'),
'view_item' => __('View Restaurant Type'),
'search_items' => __('Search Restaurants'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rest_icon' => get_stylesheet_directory_uri() . '/rest-admin-icon.png',
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => true,
'menu_position' => null,
'supports' => array('title','editor','thumbnail')
);
register_post_type( 'restaurants' , $args );
}
/*end custom post type for menus*/
register_taxonomy("Restaurant Types", array("restaurants"), array("hierarchical" => true, "label" => "Restaurant Type", "singular_label" => "Restaurant Type", "rewrite" => true));