Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 12162)
+++ wp-includes/taxonomy.php	(working copy)
@@ -180,20 +180,46 @@
 		$wp->add_query_var($args['query_var']);
 	}
 
-	if ( false !== $args['rewrite'] && !empty($wp_rewrite) ) {
+	if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
 		if ( !is_array($args['rewrite']) )
 			$args['rewrite'] = array();
 		if ( !isset($args['rewrite']['slug']) )
 			$args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
 		$wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term");
-		$wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%");
+		$wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%");
 	}
 
 	$args['name'] = $taxonomy;
-	$args['object_type'] = $object_type;
+	$args['object_type'] = (array) $object_type;
 	$wp_taxonomies[$taxonomy] = (object) $args;
 }
 
+/**
+ * Add an already registered taxonomy to a post type.
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 2.9.0
+ * @uses $wp_taxonomies Modifies taxonomy object
+ *
+ * @param string $taxonomy Name of taxonomy object
+ * @param array|string $object_type Name of the post type
+ * @return bool True if successful, false if not
+ */
+function register_taxonomy_for_post_type( $taxonomy, $post_type) {
+	global $wp_taxonomies;
+
+	if ( !isset($wp_taxonomies[$taxonomy]) )
+		return false;
+
+	if ( ! get_post_type_object($post_type) )
+		return false;
+
+	$wp_taxonomies[$taxonomy]->object_type[] = $post_type;
+
+	return true;
+}
+
 //
 // Term API
 //
@@ -2213,7 +2239,7 @@
 	$slug = $term->slug;
 
 	if ( empty($termlink) ) {
-		$file = get_option('home') . '/';
+		$file = trailingslashit(get_option( 'home' ));
 		$t = get_taxonomy($taxonomy);
 		if ( $t->query_var )
 			$termlink = "$file?$t->query_var=$slug";
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 12162)
+++ wp-includes/post.php	(working copy)
@@ -15,10 +15,10 @@
  * Creates the initial post types when 'init' action is fired.
  */
 function create_initial_post_types() {
-	register_post_type( 'post', array('exclude_from_search' => false) );
-	register_post_type( 'page', array('exclude_from_search' => false) );
-	register_post_type( 'attachment', array('exclude_from_search' => false) );
-	register_post_type( 'revision', array('exclude_from_search' => true) );
+	register_post_type( 'post', array('label' => __('Posts'), 'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false) );
+	register_post_type( 'page', array('label' => __('Pages'),'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'page.php?post=%d', 'capability_type' => 'page', 'hierarchical' => true) );
+	register_post_type( 'attachment', array('label' => __('Media'), 'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'media.php?attachment_id=%d', 'capability_type' => 'post', 'hierarchical' => false) );
+	register_post_type( 'revision', array('label' => __('Revisions'),'exclude_from_search' => true, '_builtin' => true, '_edit_link' => 'revision.php?revision=%d', 'capability_type' => 'post', 'hierarchical' => false) );
 }
 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
 
@@ -425,6 +425,28 @@
 }
 
 /**
+ * Retrieve a post type object by name
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.9.0
+ * @uses $wp_post_types
+ * @see register_post_type
+ * @see get_post_types
+ *
+ * @param string $post_type The name of a registered post type
+ * @return object A post type object
+ */
+function get_post_type_object( $post_type ) {
+	global $wp_post_types;
+
+	if ( empty($wp_post_types[$post_type]) )
+		return null;
+
+	return $wp_post_types[$post_type];
+}
+
+/**
  * Get a list of all registered post type objects.
  *
  * @package WordPress
@@ -474,7 +496,12 @@
  *
  * Optional $args contents:
  *
+ * label - A descriptibe name for the post type marked for translation. Defaults to $post_type.
+ * public - Whether posts of this type should be shown in the admin UI. Defaults to true.
  * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true.
+ * inherit_type - The post type from which to inherit the edit link and capability type. Defaults to none.
+ * capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post".
+ * hierarchical - Whether the post type is hierarchical. Defaults to false.
  *
  * @package WordPress
  * @subpackage Post
@@ -490,12 +517,31 @@
 	if (!is_array($wp_post_types))
 		$wp_post_types = array();
 
-	$defaults = array('exclude_from_search' => true);
+	// Args prefixed with an underscore are reserved for internal use.
+	$defaults = array('label' => false, 'exclude_from_search' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false);
 	$args = wp_parse_args($args, $defaults);
+	$args = (object) $args;
 
 	$post_type = sanitize_user($post_type, true);
-	$args['name'] = $post_type;
-	$wp_post_types[$post_type] = (object) $args;
+	$args->name = $post_type;
+
+	if ( false === $args->label )
+		$args->label = $post_type;
+
+	if ( empty($args->capability_type) ) {
+		$args->edit_cap = '';
+		$args->read_cap = '';
+	} else {
+		$args->edit_cap = 'edit_' . $args->capability_type;
+		$args->read_cap = 'read_' . $args->capability_type;
+	}
+
+	if ( !$args->_builtin && $args->public )
+		$args->_show = true;
+
+	$wp_post_types[$post_type] = $args;
+
+	return $args;
 }
 
 /**
@@ -1001,7 +1047,8 @@
 
 	$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
 	if ( 'readable' == $perm && is_user_logged_in() ) {
-		if ( !current_user_can("read_private_{$type}s") ) {
+		$post_type_object = get_post_type_object($type);
+		if ( !current_user_can("read_private_{$post_type_object->capability_type}s") ) {
 			$cache_key .= '_' . $perm . '_' . $user->ID;
 			$query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))";
 		}
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 12162)
+++ wp-includes/query.php	(working copy)
@@ -2079,8 +2079,13 @@
 
 		if ( is_array($post_type) )
 			$post_type_cap = 'multiple_post_type';
-		else
-			$post_type_cap = $post_type;
+		else {
+			$post_type_object = get_post_type_object ( $post_type );
+			if ( !empty($post_type_object) )
+				$post_type_cap = $post_type_object->capability_type; 
+			else
+				$post_type_cap = $post_type;
+		}
 
 		$exclude_post_types = '';
 		foreach ( get_post_types( array('exclude_from_search' => true) ) as $_wp_post_type )
Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 12162)
+++ wp-includes/link-template.php	(working copy)
@@ -675,39 +675,19 @@
 		return;
 
 	if ( 'display' == $context )
-		$action = 'action=edit&amp;';
+		$action = '&amp;action=edit';
 	else
-		$action = 'action=edit&';
+		$action = '&action=edit';
 
-	switch ( $post->post_type ) :
-	case 'page' :
-		if ( !current_user_can( 'edit_page', $post->ID ) )
-			return;
-		$file = 'page';
-		$var  = 'post';
-		break;
-	case 'attachment' :
-		if ( !current_user_can( 'edit_post', $post->ID ) )
-			return;
-		$file = 'media';
-		$var  = 'attachment_id';
-		break;
-	case 'revision' :
-		if ( !current_user_can( 'edit_post', $post->ID ) )
-			return;
-		$file = 'revision';
-		$var  = 'revision';
-		$action = '';
-		break;
-	default :
-		if ( !current_user_can( 'edit_post', $post->ID ) )
-			return apply_filters( 'get_edit_post_link', '', $post->ID, $context );;
-		$file = 'post';
-		$var  = 'post';
-		break;
-	endswitch;
+	$post_type_object = get_post_type_object( $post->post_type );
 
-	return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
+	if ( !$post_type_object )
+		return;
+
+	if ( !current_user_can( $post_type_object->edit_cap, $post->ID ) )
+		return;
+
+	return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), $post->ID, $context );
 }
 
 /**
Index: wp-includes/capabilities.php
===================================================================
--- wp-includes/capabilities.php	(revision 12162)
+++ wp-includes/capabilities.php	(working copy)
@@ -777,8 +777,9 @@
 		$author_data = get_userdata( $user_id );
 		//echo "post ID: {$args[0]}<br />";
 		$post = get_post( $args[0] );
-		if ( 'page' == $post->post_type ) {
-			$args = array_merge( array( 'delete_page', $user_id ), $args );
+		$post_type = get_post_type_object( $post->post_type );
+		if ( $post_type && 'post' != $post_type->capability_type ) {
+			$args = array_merge( array( 'delete_' . $post_type->capability_type, $user_id ), $args );
 			return call_user_func_array( 'map_meta_cap', $args );
 		}
 
@@ -845,8 +846,9 @@
 		$author_data = get_userdata( $user_id );
 		//echo "post ID: {$args[0]}<br />";
 		$post = get_post( $args[0] );
-		if ( 'page' == $post->post_type ) {
-			$args = array_merge( array( 'edit_page', $user_id ), $args );
+		$post_type = get_post_type_object( $post->post_type );
+		if ( $post_type && 'post' != $post_type->capability_type ) {
+			$args = array_merge( array( 'edit_' . $post_type->capability_type, $user_id ), $args );
 			return call_user_func_array( 'map_meta_cap', $args );
 		}
 		$post_author_data = get_userdata( $post->post_author );
@@ -903,8 +905,9 @@
 		break;
 	case 'read_post':
 		$post = get_post( $args[0] );
-		if ( 'page' == $post->post_type ) {
-			$args = array_merge( array( 'read_page', $user_id ), $args );
+		$post_type = get_post_type_object( $post->post_type );
+		if ( $post_type && 'post' != $post_type->capability_type ) {
+			$args = array_merge( array( 'read_' . $post_type->capability_type, $user_id ), $args );
 			return call_user_func_array( 'map_meta_cap', $args );
 		}
 
Index: wp-admin/menu-header.php
===================================================================
--- wp-admin/menu-header.php	(revision 12162)
+++ wp-admin/menu-header.php	(working copy)
@@ -45,7 +45,7 @@
 		if ( !empty($submenu[$item[2]]) )
 			$class[] = 'wp-has-submenu';
 
-		if ( ( $parent_file && $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) {
+		if ( ( $parent_file && $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') && strcmp($self, $item[2]) == 0 ) ) {
 			if ( !empty($submenu[$item[2]]) )
 				$class[] = 'wp-has-current-submenu wp-menu-open';
 			else
Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 12162)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -1126,7 +1126,7 @@
 	if ( 'page' == $_POST['post_type'] ) {
 		$post[] = get_post($_POST['post_ID']);
 		page_rows($post);
-	} elseif ( 'post' == $_POST['post_type'] ) {
+	} elseif ( 'post' == $_POST['post_type'] || in_array($_POST['post_type'], get_post_types( array('_show' => true) ) ) ) {
 		$mode = $_POST['post_view'];
 		$post[] = get_post($_POST['post_ID']);
 		post_rows($post);
Index: wp-admin/post-new.php
===================================================================
--- wp-admin/post-new.php	(revision 12162)
+++ wp-admin/post-new.php	(working copy)
@@ -8,8 +8,24 @@
 
 /** Load WordPress Administration Bootstrap */
 require_once('admin.php');
-$title = __('Add New Post');
-$parent_file = 'edit.php';
+
+if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )
+	$post_type = $_GET['post_type'];
+else
+	$post_type = 'post';
+
+if ( 'post' != $post_type ) {
+	$parent_file = "edit.php?post_type=$post_type";
+	$submenu_file = "post-new.php?post_type=$post_type";
+} else {
+	$parent_file = 'edit.php';
+	$submenu_file = 'post-new.php';
+}
+
+$post_type_object = get_post_type_object($post_type);
+
+$title = sprintf(__('Add New %s'), $post_type_object->label);
+
 $editing = true;
 wp_enqueue_script('autosave');
 wp_enqueue_script('post');
@@ -34,6 +50,7 @@
 
 // Show post form.
 $post = get_default_post_to_edit();
+$post->post_type = $post_type;
 include('edit-form-advanced.php');
 
 include('admin-footer.php');
Index: wp-admin/includes/plugin.php
===================================================================
--- wp-admin/includes/plugin.php	(revision 12162)
+++ wp-admin/includes/plugin.php	(working copy)
@@ -745,14 +745,15 @@
 			$parent = $_wp_real_parent_file[$parent];
 		return $parent;
 	}
-/*
+
+	/*
 	if ( !empty ( $parent_file ) ) {
 		if ( isset( $_wp_real_parent_file[$parent_file] ) )
 			$parent_file = $_wp_real_parent_file[$parent_file];
 
 		return $parent_file;
 	}
-*/
+	*/
 
 	if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
 		foreach ( (array)$menu as $parent_menu ) {
@@ -782,7 +783,7 @@
 		foreach ( $submenu[$parent] as $submenu_array ) {
 			if ( isset( $_wp_real_parent_file[$parent] ) )
 				$parent = $_wp_real_parent_file[$parent];
-			if ( $submenu_array[2] == $pagenow ) {
+			if ( $submenu_array[2] == $pagenow && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
 				$parent_file = $parent;
 				return $parent;
 			} else
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 12162)
+++ wp-admin/includes/post.php	(working copy)
@@ -826,12 +826,17 @@
 		$orderby = 'date';
 	}
 
+	$post_type_q = 'post_type=post';
+
+	if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true) ) ) )
+		$post_type_q = 'post_type=' . $q['post_type'];
+
 	$posts_per_page = get_user_option('edit_per_page');
 	if ( empty($posts_per_page) )
 		$posts_per_page = 15;
 	$posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page);
 
-	wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
+	wp("$post_type_q$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
 
 	return array($post_stati, $avail_post_stati);
 }
Index: wp-admin/includes/meta-boxes.php
===================================================================
--- wp-admin/includes/meta-boxes.php	(revision 12162)
+++ wp-admin/includes/meta-boxes.php	(working copy)
@@ -13,7 +13,9 @@
 	global $action;
 
 	$post_type = $post->post_type;
-	$can_publish = current_user_can("publish_${post_type}s");
+    $post_type_object = get_post_type_object($post_type);
+	$type_cap = $post_type_object->capability_type;
+	$can_publish = current_user_can("publish_${type_cap}s");
 ?>
 <div class="submitbox" id="submitpost">
 
@@ -184,7 +186,7 @@
 <?php do_action('post_submitbox_start'); ?>
 <div id="delete-action">
 <?php
-if ( current_user_can("delete_${post_type}", $post->ID) ) {
+if ( current_user_can("delete_${type_cap}", $post->ID) ) {
 	if ( !EMPTY_TRASH_DAYS ) {
 		$delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID) ), "delete-${post_type}_{$post->ID}" );
 		$delete_text = __('Delete Permanently');
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 12162)
+++ wp-admin/includes/template.php	(working copy)
@@ -3460,7 +3460,7 @@
 }
 
 function screen_meta($screen) {
-	global $wp_meta_boxes, $_wp_contextual_help;
+	global $wp_meta_boxes, $_wp_contextual_help, $typenow;
 
 	$screen = str_replace('.php', '', $screen);
 	$screen = str_replace('-new', '', $screen);
@@ -3470,6 +3470,12 @@
 	$column_screens = get_column_headers($screen);
 	$meta_screens = array('index' => 'dashboard');
 
+	// Give post_type pages their own screen
+	if ( 'post' == $screen ) {
+		if ( !empty($typenow) )
+			$screen = $typenow;
+	}
+
 	if ( isset($meta_screens[$screen]) )
 		$screen = $meta_screens[$screen];
 	$show_screen = false;
@@ -3653,6 +3659,11 @@
 	global $screen_layout_columns;
 
 	$columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2);
+
+	// Add custom post types
+	foreach ( get_post_types( array('_show' => true) ) as $post_type )
+		$columns[$post_type] = 2;
+
 	$columns = apply_filters('screen_layout_columns', $columns, $screen);
 
 	if ( !isset($columns[$screen]) ) {
@@ -3726,8 +3737,12 @@
 	global $parent_file, $hook_suffix;
 
 	if ( empty($name) ) {
-		if ( isset($parent_file) && !empty($parent_file) )
-			$name = substr($parent_file, 0, -4);
+		if ( isset($parent_file) && !empty($parent_file) ) {
+			$name = $parent_file;
+			if ( false !== $pos = strpos($name, '?post_type=') )
+				$name = substr($name, 0, $pos);
+			$name = substr($name, 0, -4);
+		}
 		else
 			$name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
 	}
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 12162)
+++ wp-admin/post.php	(working copy)
@@ -120,6 +120,7 @@
 	}
 	$post_ID = $p = (int) $_GET['post'];
 	$post = get_post($post_ID);
+	$post_type_object = get_post_type_object($post->post_type);
 
 	if ( empty($post->ID) )
 		wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') );
@@ -130,11 +131,20 @@
 	if ( 'trash' == $post->post_status )
 		wp_die( __('You can&#8217;t edit this post because it is in the Trash. Please restore it and try again.') );
 
-	if ( 'post' != $post->post_type ) {
+	if ( null == $post_type_object )
+		wp_die( __('Unknown post type.') );
+
+	if ( 'post' != $post->post_type && $post_type_object->_builtin ) {
 		wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
 		exit();
 	}
 
+	$post_type = $post->post_type;
+	if ( 'post' != $post_type ) {
+		$parent_file = "edit.php?post_type=$post_type";
+		$submenu_file = "edit.php?post_type=$post_type";
+	}
+
 	wp_enqueue_script('post');
 	if ( user_can_richedit() )
 		wp_enqueue_script('editor');
@@ -151,7 +161,7 @@
 		wp_enqueue_script('autosave');
 	}
 
-	$title = __('Edit Post');
+	$title = sprintf(__('Edit %s'), $post_type_object->label);
 	$post = get_post_to_edit($post_ID);
 
 	include('edit-form-advanced.php');
Index: wp-admin/js/post.dev.js
===================================================================
--- wp-admin/js/post.dev.js	(revision 12162)
+++ wp-admin/js/post.dev.js	(working copy)
@@ -231,10 +231,14 @@
 	var catAddAfter, stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
 
 	// postboxes
-	if ( post )
-		postboxes.add_postbox_toggles('post');
-	else if ( page )
+	if ( post ) {
+		type = 'post';
+		if ( typenow )
+			type = typenow;
+		postboxes.add_postbox_toggles(type);
+	} else if ( page ) {
 		postboxes.add_postbox_toggles('page');
+	}
 
 	// multi-taxonomies
 	if ( $('#tagsdiv-post_tag').length ) {
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 12162)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -85,46 +85,51 @@
 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
 require_once('includes/meta-boxes.php');
 
-add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
+add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
 
 // all tag-style post taxonomies
-foreach ( get_object_taxonomies('post') as $tax_name ) {
+foreach ( get_object_taxonomies($post_type) as $tax_name ) {
 	if ( !is_taxonomy_hierarchical($tax_name) ) {
 		$taxonomy = get_taxonomy($tax_name);
 		$label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
 
-		add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
+		add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
 	}
 }
 
-add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
+if ( 'post' == $post_type )
+	add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core');
+
 if ( current_theme_supports( 'post-thumbnails' ) )
-	add_meta_box('postthumbnaildiv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
-add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
-add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
-add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
+	add_meta_box('postthumbnaildiv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low');
+
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core');
+add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core');
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core');
 do_action('dbx_post_advanced');
-add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
+add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core');
 
 if ( 'publish' == $post->post_status || 'private' == $post->post_status )
-	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core');
+	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
 
 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
-	add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
+	add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
 
 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
 if ( $post->post_author && !in_array($post->post_author, $authors) )
 	$authors[] = $post->post_author;
 if ( $authors && count( $authors ) > 1 )
-	add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
+	add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
 
 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
-	add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
+	add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');
 
-do_action('do_meta_boxes', 'post', 'normal', $post);
-do_action('do_meta_boxes', 'post', 'advanced', $post);
-do_action('do_meta_boxes', 'post', 'side', $post);
+do_action('add_meta_boxes', $post_type);
 
+do_action('do_meta_boxes', $post_type, 'normal', $post);
+do_action('do_meta_boxes', $post_type, 'advanced', $post);
+do_action('do_meta_boxes', $post_type, 'side', $post);
+
 require_once('admin-header.php');
 
 ?>
@@ -152,7 +157,7 @@
 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" />
 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
-<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" />
 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
 <?php
@@ -166,7 +171,7 @@
 
 <?php do_action('submitpost_box'); ?>
 
-<?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
+<?php $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); ?>
 </div>
 
 <div id="post-body">
@@ -223,11 +228,11 @@
 
 <?php
 
-do_meta_boxes('post', 'normal', $post);
+do_meta_boxes($post_type, 'normal', $post);
 
 do_action('edit_form_advanced');
 
-do_meta_boxes('post', 'advanced', $post);
+do_meta_boxes($post_type, 'advanced', $post);
 
 do_action('dbx_post_sidebar'); ?>
 
Index: wp-admin/menu.php
===================================================================
--- wp-admin/menu.php	(revision 12162)
+++ wp-admin/menu.php	(working copy)
@@ -65,6 +65,25 @@
 
 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
 
+foreach ( (array) get_post_types( array('_show' => true) ) as $ptype ) {
+	$_wp_last_object_menu++;
+	$ptype_obj = get_post_type_object($ptype);
+	$menu[$_wp_last_object_menu] = array(esc_attr($ptype_obj->label), 'edit_' . $ptype_obj->capability_type . 's', "edit.php?post_type=$ptype", '', 'menu-top', 'menu-posts', 'div');
+	$submenu["edit.php?post_type=$ptype"][5]  = array( __('Edit'), 'edit_posts',  "edit.php?post_type=$ptype");
+	/* translators: add new custom post type */
+	$submenu["edit.php?post_type=$ptype"][10]  = array( _x('Add New', 'post'), 'edit_posts', "post-new.php?post_type=$ptype" );
+
+	$i = 15;
+	foreach ( $wp_taxonomies as $tax ) {
+		if ( $tax->hierarchical || ! in_array($ptype, (array) $tax->object_type, true) )
+			continue;
+
+		$submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
+		++$i;
+	}
+}
+unset($ptype, $ptype_obj);
+
 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
 
 $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
Index: wp-admin/admin-header.php
===================================================================
--- wp-admin/admin-header.php	(revision 12162)
+++ wp-admin/admin-header.php	(working copy)
@@ -35,13 +35,20 @@
 else if ( isset($pagenow) )
 	$hook_suffix = "$pagenow";
 
+if ( isset($submenu_file) && (false !== $pos = strpos($submenu_file, 'post_type=')) )
+	$typenow = substr($submenu_file, $pos + 10);
+elseif ( isset($parent_file) && (false !== $pos = strpos($parent_file, 'post_type=')) )
+	$typenow = substr($parent_file, $pos + 10);
+else
+	$typenow = '';
+
 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
 ?>
 <script type="text/javascript">
 //<![CDATA[
 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
 var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
-var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>',  thousandsSeparator = '<?php echo $wp_locale->number_format['thousands_sep']; ?>', decimalPoint = '<?php echo $wp_locale->number_format['decimal_point']; ?>';
+var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', typenow = '<?php echo $typenow; ?>', adminpage = '<?php echo $admin_body_class; ?>',  thousandsSeparator = '<?php echo $wp_locale->number_format['thousands_sep']; ?>', decimalPoint = '<?php echo $wp_locale->number_format['decimal_point']; ?>';
 //]]>
 </script>
 <?php
Index: wp-admin/edit.php
===================================================================
--- wp-admin/edit.php	(revision 12162)
+++ wp-admin/edit.php	(working copy)
@@ -20,17 +20,34 @@
 	unset( $_redirect );
 }
 
+if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )
+	$post_type = $_GET['post_type'];
+else
+	$post_type = 'post';
+
+$post_type_object = get_post_type_object($post_type);
+
+if ( 'post' != $post_type ) {
+	$parent_file = "edit.php?post_type=$post_type";
+	$submenu_file = "edit.php?post_type=$post_type";
+	$post_new_file = "post-new.php?post_type=$post_type";
+} else {
+	$parent_file = 'edit.php';
+	$submenu_file = 'edit.php';
+	$post_new_file = 'post-new.php';
+}
+
 // Handle bulk actions
 if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {
 	check_admin_referer('bulk-posts');
 	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
 
 	if ( strpos($sendback, 'post.php') !== false )
-		$sendback = admin_url('post-new.php');
+		$sendback = admin_url($post_new_file);
 
 	if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
 		$post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);
-		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='post' AND post_status = %s", $post_status ) );
+		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
 		$doaction = 'delete';
 	} elseif ( ( $_GET['action'] != -1 || $_GET['action2'] != -1 ) && ( isset($_GET['post']) || isset($_GET['ids']) ) ) {
 		$post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);
@@ -107,14 +124,13 @@
 	 exit;
 }
 
-if ( empty($title) )
-	$title = __('Edit Posts');
-$parent_file = 'edit.php';
+$title = sprintf(__('Edit %s'), $post_type_object->label);
+
 wp_enqueue_script('inline-edit-post');
 
 $user_posts = false;
 if ( !current_user_can('edit_others_posts') ) {
-	$user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = 'post' AND post_status != 'trash' AND post_author = %d", $current_user->ID) );
+	$user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = 'p%s' AND post_status != 'trash' AND post_author = %d", $post_type, $current_user->ID) );
 	$user_posts = true;
 	if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) )
 		$_GET['author'] = $current_user->ID;
@@ -134,7 +150,7 @@
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="post-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php
+<h2><?php echo esc_html( $title ); ?> <a href="<?php echo $post_new_file ?>" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php
 if ( isset($_GET['s']) && $_GET['s'] )
 	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
 </h2>
@@ -188,7 +204,7 @@
 <?php
 if ( empty($locked_post_status) ) :
 $status_links = array();
-$num_posts = wp_count_posts( 'post', 'readable' );
+$num_posts = wp_count_posts( $post_type, 'readable' );
 $class = '';
 $allposts = '';
 
@@ -215,7 +231,7 @@
 	if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
 		$class = ' class="current"';
 
-	$status_links[] = "<li><a href='edit.php?post_status=$status'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
+	$status_links[] = "<li><a href='edit.php?post_status=$status&amp;post_type=$post_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset( $status_links );
@@ -230,6 +246,7 @@
 </p>
 
 <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_GET['post_status']) ? esc_attr($_GET['post_status']) : 'all'; ?>" />
+<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
 <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
 
 <?php if ( have_posts() ) { ?>
@@ -267,7 +284,7 @@
 
 <?php // view filters
 if ( !is_singular() ) {
-$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
+$arc_query = $wpdb->prepare("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = %s ORDER BY post_date DESC", $post_type);
 
 $arc_result = $wpdb->get_results( $arc_query );
 
