<?php
//----------------------------------------------------------------------//
// Initiate the plugin to add custom post type of "places" and "events"
//----------------------------------------------------------------------//
add_action("init", "custom_posttype_menu_wp_admin");
function custom_posttype_menu_wp_admin()
{
//===============EVENT SECTION START================
register_post_type(	CUSTOM_POST_TYPE1, 
				array(	'label' 			=> CUSTOM_POST_LABEL,
						'labels' 			=> array(	'name' 					=> CUSTOM_POST_NAME,
														'singular_name' 		=> CUSTOM_POST_SINGULAR_NAME,
														'add_new' 				=>  CUSTOM_POST_ADD_NEW,
														'add_new_item' 			=>  CUSTOM_POST_ADD_NEW_ITEM,
														'edit' 					=>  CUSTOM_POST_EDIT,
														'edit_item' 			=>  CUSTOM_POST_EDIT_ITEM,
														'new_item' 				=>  CUSTOM_POST_NEW_ITEM,
														'view_item'				=>  CUSTOM_POST_VIEW_ITEM,
														'search_items' 			=>  CUSTOM_POST_SEARCH_ITEM,
														'not_found' 			=>  CUSTOM_POST_NOT_FOUND,
														'not_found_in_trash' 	=>  CUSTOM_POST_NOT_FOUND_IN_TRASH	),
						'public' 			=> true,
						'can_export'		=> true,
						'show_ui' 			=> true, // UI in admin panel
						'_builtin' 			=> false, // It's a custom post type, not built in
						'_edit_link' 		=> 'post.php?post=%d',
						'capability_type' 	=> 'post',
						'menu_icon' 		=> get_bloginfo('template_url').'/images/favicon.ico',
						'hierarchical' 		=> false,
						'rewrite' 			=> array(	"slug" => CUSTOM_POST_TYPE1	), // Permalinks
						'query_var' 		=> CUSTOM_POST_TYPE1, // This goes to the WP_Query schema
						'supports' 			=> array(	'title',
														'author', 
														'excerpt',
														'thumbnail',
														'comments',
														'editor', 
														'trackbacks',
														'custom-fields',
														'revisions') ,
						'show_in_nav_menus'	=> true ,
						'taxonomies'		=> array(CUSTOM_CATEGORY_TYPE1,CUSTOM_TAG_TYPE1)
					)
				);

// Register custom taxonomy
register_taxonomy(	CUSTOM_CATEGORY_TYPE1, 
				array(	CUSTOM_POST_TYPE1	), 
				array (	"hierarchical" 		=> true, 
						"label" 			=> CUSTOM_TAXONOMY_LABEL, 
						'labels' 			=> array(	'name' 				=>  CUSTOM_TAXONOMY_NAME,
														'singular_name' 	=>  CUSTOM_TAXONOMY_SINGULAR_NAME,
														'search_items' 		=>  CUSTOM_TAXONOMY_SEARCH_ITEM,
														'popular_items' 	=>  CUSTOM_TAXONOMY_POPULAR_ITEM,
														'all_items' 		=>  CUSTOM_TAXONOMY_ALL_ITEMS,
														'parent_item' 		=>  CUSTOM_TAXONOMY_PARENT_ITEM,
														'parent_item_colon' =>  CUSTOM_TAXONOMY_PARENT_ITEM_COLON,
														'edit_item' 		=>  CUSTOM_TAXONOMY_EDIT_ITEM,
														'update_item'		=>  CUSTOM_TAXONOMY_UPDATE_ITEM,
														'add_new_item' 		=>  CUSTOM_TAXONOMY_ADD_NEW_ITEM,
														'new_item_name' 	=>  CUSTOM_TAXONOMY_NEW_ITEM_NAME	), 
						'public' 			=> true,
						'show_ui' 			=> true,
						"rewrite" 			=> true	)
				);


register_taxonomy(CUSTOM_TAG_TYPE1, 
				array(	CUSTOM_POST_TYPE1	), 
				array(	"hierarchical" 		=> false, 
						"label" 			=> CUSTOM_TAG_LABEL, 
						'labels' 			=> array(	'name' 				=> CUSTOM_TAG_NAME,
														'singular_name' 	=> CUSTOM_TAG_SINGULAR_NAME,
														'search_items' 		=> CUSTOM_TAG_SEARCH_ITEMS,
														'popular_items' 	=> CUSTOM_TAG_POPULAR_ITEMS,
														'all_items' 		=> CUSTOM_TAG_ALL_ITEMS,
														'parent_item' 		=> CUSTOM_TAG_PARENT_ITEM,
														'parent_item_colon' => CUSTOM_TAG_PARENT_ITEM_COLON,
														'edit_item' 		=> CUSTOM_TAG_EDIT_ITEM,
														'update_item'		=> CUSTOM_TAG_UPDATE_ITEM,
														'add_new_item' 		=> CUSTOM_TAG_ADD_NEW_ITEM,
														'new_item_name' 	=> CUSTOM_TAG_NEW_ITEM_NAME	),  
						'public' 			=> true,
						'show_ui' 			=> true,
						"rewrite" 			=> true	)
				);
//===============EVENT SECTION END================
}

/////The filter code to get the custom post type in the RSS feed
function myfeed_request($qv) {
	if (isset($qv['feed']))
		$qv['post_type'] = get_post_types();
	return $qv;
}
add_filter('request', 'myfeed_request');

?>