<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12597] trunk: More custom post type support.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12597">12597</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-04 16:58:43 +0000 (Mon, 04 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>More custom post type support. Props scribu. see <a href="http://trac.wordpress.org/ticket/9674">#9674</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadminadminheaderphp">trunk/wp-admin/admin-header.php</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjspostdevjs">trunk/wp-admin/js/post.dev.js</a></li>
<li><a href="#trunkwpadminjspostjs">trunk/wp-admin/js/post.js</a></li>
<li><a href="#trunkwpadminmenuheaderphp">trunk/wp-admin/menu-header.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpadminpostnewphp">trunk/wp-admin/post-new.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpincludescapabilitiesphp">trunk/wp-includes/capabilities.php</a></li>
<li><a href="#trunkwpincludeslinktemplatephp">trunk/wp-includes/link-template.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesqueryphp">trunk/wp-includes/query.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/admin-ajax.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -1135,7 +1135,7 @@
</span><span class="cx">         if ( 'page' == $_POST['post_type'] ) {
</span><span class="cx">                 $post[] = get_post($_POST['post_ID']);
</span><span class="cx">                 page_rows($post);
</span><del>-        } elseif ( 'post' == $_POST['post_type'] ) {
</del><ins>+        } elseif ( 'post' == $_POST['post_type'] || in_array($_POST['post_type'], get_post_types( array('_show' =&gt; true) ) ) ) {
</ins><span class="cx">                 $mode = $_POST['post_view'];
</span><span class="cx">                 $post[] = get_post($_POST['post_ID']);
</span><span class="cx">                 post_rows($post);
</span></span></pre></div>
<a id="trunkwpadminadminheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-header.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-header.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/admin-header.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -35,13 +35,20 @@
</span><span class="cx"> else if ( isset($pagenow) )
</span><span class="cx">         $hook_suffix = $pagenow;
</span><span class="cx"> 
</span><ins>+if ( isset($submenu_file) &amp;&amp; (false !== $pos = strpos($submenu_file, 'post_type=')) )
+        $typenow = substr($submenu_file, $pos + 10);
+elseif ( isset($parent_file) &amp;&amp; (false !== $pos = strpos($parent_file, 'post_type=')) )
+        $typenow = substr($parent_file, $pos + 10);
+else
+        $typenow = '';
+
</ins><span class="cx"> $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;script type=&quot;text/javascript&quot;&gt;
</span><span class="cx"> //&lt;![CDATA[
</span><span class="cx"> addLoadEvent = function(func){if(typeof jQuery!=&quot;undefined&quot;)jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
</span><span class="cx"> var userSettings = {'url':'&lt;?php echo SITECOOKIEPATH; ?&gt;','uid':'&lt;?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user-&gt;ID; ?&gt;','time':'&lt;?php echo time() ?&gt;'};
</span><del>-var ajaxurl = '&lt;?php echo admin_url('admin-ajax.php'); ?&gt;', pagenow = '&lt;?php echo substr($pagenow, 0, -4); ?&gt;', adminpage = '&lt;?php echo $admin_body_class; ?&gt;',  thousandsSeparator = '&lt;?php echo $wp_locale-&gt;number_format['thousands_sep']; ?&gt;', decimalPoint = '&lt;?php echo $wp_locale-&gt;number_format['decimal_point']; ?&gt;';
</del><ins>+var ajaxurl = '&lt;?php echo admin_url('admin-ajax.php'); ?&gt;', pagenow = '&lt;?php echo substr($pagenow, 0, -4); ?&gt;', typenow = '&lt;?php echo $typenow; ?&gt;', adminpage = '&lt;?php echo $admin_body_class; ?&gt;',  thousandsSeparator = '&lt;?php echo $wp_locale-&gt;number_format['thousands_sep']; ?&gt;', decimalPoint = '&lt;?php echo $wp_locale-&gt;number_format['decimal_point']; ?&gt;';
</ins><span class="cx"> //]]&gt;
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;?php
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/edit-form-advanced.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -85,45 +85,46 @@
</span><span class="cx"> // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
</span><span class="cx"> require_once('includes/meta-boxes.php');
</span><span class="cx"> 
</span><del>-add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
</del><ins>+add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
</ins><span class="cx"> 
</span><span class="cx"> // all tag-style post taxonomies
</span><del>-foreach ( get_object_taxonomies('post') as $tax_name ) {
</del><ins>+foreach ( get_object_taxonomies($post_type) as $tax_name ) {
</ins><span class="cx">         if ( !is_taxonomy_hierarchical($tax_name) ) {
</span><span class="cx">                 $taxonomy = get_taxonomy($tax_name);
</span><span class="cx">                 $label = isset($taxonomy-&gt;label) ? esc_attr($taxonomy-&gt;label) : $tax_name;
</span><span class="cx"> 
</span><del>-                add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
</del><ins>+                add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
-if ( current_theme_supports( 'post-thumbnails', 'post' ) )
-        add_meta_box('postimagediv', __('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');
</del><ins>+if ( is_object_in_taxonomy($post_type, 'category') )
+        add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core');
+if ( current_theme_supports( 'post-thumbnails', $post_type ) )
+        add_meta_box('postimagediv', __('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');
</ins><span class="cx"> do_action('dbx_post_advanced');
</span><del>-add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
</del><ins>+add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core');
</ins><span class="cx"> 
</span><span class="cx"> if ( 'publish' == $post-&gt;post_status || 'private' == $post-&gt;post_status )
</span><del>-        add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core');
</del><ins>+        add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
</ins><span class="cx"> 
</span><span class="cx"> if ( !( 'pending' == $post-&gt;post_status &amp;&amp; !current_user_can( 'publish_posts' ) ) )
</span><del>-        add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
</del><ins>+        add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
</ins><span class="cx"> 
</span><span class="cx"> $authors = get_editable_user_ids( $current_user-&gt;id ); // TODO: ROLE SYSTEM
</span><span class="cx"> if ( $post-&gt;post_author &amp;&amp; !in_array($post-&gt;post_author, $authors) )
</span><span class="cx">         $authors[] = $post-&gt;post_author;
</span><span class="cx"> if ( $authors &amp;&amp; count( $authors ) &gt; 1 )
</span><del>-        add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
</del><ins>+        add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
</ins><span class="cx"> 
</span><span class="cx"> if ( 0 &lt; $post_ID &amp;&amp; wp_get_post_revisions( $post_ID ) )
</span><del>-        add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
</del><ins>+        add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');
</ins><span class="cx"> 
</span><del>-do_action('do_meta_boxes', 'post', 'normal', $post);
-do_action('do_meta_boxes', 'post', 'advanced', $post);
-do_action('do_meta_boxes', 'post', 'side', $post);
</del><ins>+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);
</ins><span class="cx"> 
</span><span class="cx"> require_once('admin-header.php');
</span><span class="cx"> 
</span><span class="lines">@@ -152,7 +153,7 @@
</span><span class="cx"> &lt;input type=&quot;hidden&quot; id=&quot;hiddenaction&quot; name=&quot;action&quot; value=&quot;&lt;?php echo esc_attr($form_action) ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; id=&quot;originalaction&quot; name=&quot;originalaction&quot; value=&quot;&lt;?php echo esc_attr($form_action) ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; id=&quot;post_author&quot; name=&quot;post_author&quot; value=&quot;&lt;?php echo esc_attr( $post-&gt;post_author ); ?&gt;&quot; /&gt;
</span><del>-&lt;input type=&quot;hidden&quot; id=&quot;post_type&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo esc_attr($post-&gt;post_type) ?&gt;&quot; /&gt;
</del><ins>+&lt;input type=&quot;hidden&quot; id=&quot;post_type&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo esc_attr($post_type) ?&gt;&quot; /&gt;
</ins><span class="cx"> &lt;input type=&quot;hidden&quot; id=&quot;original_post_status&quot; name=&quot;original_post_status&quot; value=&quot;&lt;?php echo esc_attr($post-&gt;post_status) ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php echo esc_url(stripslashes(wp_get_referer())); ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;?php
</span><span class="lines">@@ -166,7 +167,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php do_action('submitpost_box'); ?&gt;
</span><span class="cx"> 
</span><del>-&lt;?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?&gt;
</del><ins>+&lt;?php $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); ?&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div id=&quot;post-body&quot;&gt;
</span><span class="lines">@@ -223,11 +224,11 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><del>-do_meta_boxes('post', 'normal', $post);
</del><ins>+do_meta_boxes($post_type, 'normal', $post);
</ins><span class="cx"> 
</span><span class="cx"> do_action('edit_form_advanced');
</span><span class="cx"> 
</span><del>-do_meta_boxes('post', 'advanced', $post);
</del><ins>+do_meta_boxes($post_type, 'advanced', $post);
</ins><span class="cx"> 
</span><span class="cx"> do_action('dbx_post_sidebar'); ?&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/edit-tags.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -19,9 +19,19 @@
</span><span class="cx"> if ( !is_taxonomy($taxonomy) )
</span><span class="cx">         wp_die(__('Invalid taxonomy'));
</span><span class="cx"> 
</span><del>-$parent_file = 'edit.php';
-$submenu_file = &quot;edit-tags.php?taxonomy=$taxonomy&quot;;
</del><ins>+if ( isset($_GET['post_type']) &amp;&amp; in_array( $_GET['post_type'], get_post_types( array('_show' =&gt; true) ) ) )
+        $post_type = $_GET['post_type'];
+else
+        $post_type = 'post';
</ins><span class="cx"> 
</span><ins>+if ( 'post' != $post_type ) {
+        $parent_file = &quot;edit.php?post_type=$post_type&quot;;
+        $submenu_file = &quot;edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type&quot;;
+} else {
+        $parent_file = 'edit.php';
+        $submenu_file = &quot;edit-tags.php?taxonomy=$taxonomy&quot;;        
+}
+
</ins><span class="cx"> if ( isset( $_GET['action'] ) &amp;&amp; isset($_GET['delete_tags']) &amp;&amp; ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
</span><span class="cx">         $action = 'bulk-delete';
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/edit.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -20,17 +20,34 @@
</span><span class="cx">         unset( $_redirect );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+if ( isset($_GET['post_type']) &amp;&amp; in_array( $_GET['post_type'], get_post_types( array('_show' =&gt; 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 = &quot;edit.php?post_type=$post_type&quot;;
+        $submenu_file = &quot;edit.php?post_type=$post_type&quot;;
+        $post_new_file = &quot;post-new.php?post_type=$post_type&quot;;
+} else {
+        $parent_file = 'edit.php';
+        $submenu_file = 'edit.php';
+        $post_new_file = 'post-new.php';
+}
+
</ins><span class="cx"> // Handle bulk actions
</span><span class="cx"> if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {
</span><span class="cx">         check_admin_referer('bulk-posts');
</span><span class="cx">         $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
</span><span class="cx"> 
</span><span class="cx">         if ( strpos($sendback, 'post.php') !== false )
</span><del>-                $sendback = admin_url('post-new.php');
</del><ins>+                $sendback = admin_url($post_new_file);
</ins><span class="cx"> 
</span><span class="cx">         if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
</span><span class="cx">                 $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);
</span><del>-                $post_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_type='post' AND post_status = %s&quot;, $post_status ) );
</del><ins>+                $post_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_type=%s AND post_status = %s&quot;, $post_type, $post_status ) );
</ins><span class="cx">                 $doaction = 'delete';
</span><span class="cx">         } elseif ( ( $_GET['action'] != -1 || $_GET['action2'] != -1 ) &amp;&amp; ( isset($_GET['post']) || isset($_GET['ids']) ) ) {
</span><span class="cx">                 $post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);
</span><span class="lines">@@ -107,14 +124,13 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if ( empty($title) )
-        $title = __('Edit Posts');
-$parent_file = 'edit.php';
</del><ins>+$title = sprintf(__('Edit %s'), $post_type_object-&gt;label);
+
</ins><span class="cx"> wp_enqueue_script('inline-edit-post');
</span><span class="cx"> 
</span><span class="cx"> $user_posts = false;
</span><span class="cx"> if ( !current_user_can('edit_others_posts') ) {
</span><del>-        $user_posts_count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(1) FROM $wpdb-&gt;posts WHERE post_type = 'post' AND post_status != 'trash' AND post_author = %d&quot;, $current_user-&gt;ID) );
</del><ins>+        $user_posts_count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(1) FROM $wpdb-&gt;posts WHERE post_type = '%s' AND post_status != 'trash' AND post_author = %d&quot;, $post_type, $current_user-&gt;ID) );
</ins><span class="cx">         $user_posts = true;
</span><span class="cx">         if ( $user_posts_count &amp;&amp; empty($_GET['post_status']) &amp;&amp; empty($_GET['all_posts']) &amp;&amp; empty($_GET['author']) )
</span><span class="cx">                 $_GET['author'] = $current_user-&gt;ID;
</span><span class="lines">@@ -134,7 +150,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;wrap&quot;&gt;
</span><span class="cx"> &lt;?php screen_icon(); ?&gt;
</span><del>-&lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt; &lt;a href=&quot;post-new.php&quot; class=&quot;button add-new-h2&quot;&gt;&lt;?php echo esc_html_x('Add New', 'post'); ?&gt;&lt;/a&gt; &lt;?php
</del><ins>+&lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt; &lt;a href=&quot;&lt;?php echo $post_new_file ?&gt;&quot; class=&quot;button add-new-h2&quot;&gt;&lt;?php echo esc_html_x('Add New', 'post'); ?&gt;&lt;/a&gt; &lt;?php
</ins><span class="cx"> if ( isset($_GET['s']) &amp;&amp; $_GET['s'] )
</span><span class="cx">         printf( '&lt;span class=&quot;subtitle&quot;&gt;' . __('Search results for &amp;#8220;%s&amp;#8221;') . '&lt;/span&gt;', esc_html( get_search_query() ) ); ?&gt;
</span><span class="cx"> &lt;/h2&gt;
</span><span class="lines">@@ -188,7 +204,7 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> if ( empty($locked_post_status) ) :
</span><span class="cx"> $status_links = array();
</span><del>-$num_posts = wp_count_posts( 'post', 'readable' );
</del><ins>+$num_posts = wp_count_posts( $post_type, 'readable' );
</ins><span class="cx"> $class = '';
</span><span class="cx"> $allposts = '';
</span><span class="cx"> 
</span><span class="lines">@@ -215,7 +231,7 @@
</span><span class="cx">         if ( isset($_GET['post_status']) &amp;&amp; $status == $_GET['post_status'] )
</span><span class="cx">                 $class = ' class=&quot;current&quot;';
</span><span class="cx"> 
</span><del>-        $status_links[] = &quot;&lt;li&gt;&lt;a href='edit.php?post_status=$status'$class&gt;&quot; . sprintf( _n( $label[2][0], $label[2][1], $num_posts-&gt;$status ), number_format_i18n( $num_posts-&gt;$status ) ) . '&lt;/a&gt;';
</del><ins>+        $status_links[] = &quot;&lt;li&gt;&lt;a href='edit.php?post_status=$status&amp;amp;post_type=$post_type'$class&gt;&quot; . sprintf( _n( $label[2][0], $label[2][1], $num_posts-&gt;$status ), number_format_i18n( $num_posts-&gt;$status ) ) . '&lt;/a&gt;';
</ins><span class="cx"> }
</span><span class="cx"> echo implode( &quot; |&lt;/li&gt;\n&quot;, $status_links ) . '&lt;/li&gt;';
</span><span class="cx"> unset( $status_links );
</span><span class="lines">@@ -230,6 +246,7 @@
</span><span class="cx"> &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;post_status&quot; class=&quot;post_status_page&quot; value=&quot;&lt;?php echo !empty($_GET['post_status']) ? esc_attr($_GET['post_status']) : 'all'; ?&gt;&quot; /&gt;
</span><ins>+&lt;input type=&quot;hidden&quot; name=&quot;post_type&quot; class=&quot;post_type_page&quot; value=&quot;&lt;?php echo $post_type; ?&gt;&quot; /&gt;
</ins><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;&lt;?php echo esc_attr($mode); ?&gt;&quot; /&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;?php if ( have_posts() ) { ?&gt;
</span><span class="lines">@@ -267,7 +284,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php // view filters
</span><span class="cx"> if ( !is_singular() ) {
</span><del>-$arc_query = &quot;SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb-&gt;posts WHERE post_type = 'post' ORDER BY post_date DESC&quot;;
</del><ins>+$arc_query = $wpdb-&gt;prepare(&quot;SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb-&gt;posts WHERE post_type = %s ORDER BY post_date DESC&quot;, $post_type);
</ins><span class="cx"> 
</span><span class="cx"> $arc_result = $wpdb-&gt;get_results( $arc_query );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -13,7 +13,9 @@
</span><span class="cx">         global $action;
</span><span class="cx"> 
</span><span class="cx">         $post_type = $post-&gt;post_type;
</span><del>-        $can_publish = current_user_can(&quot;publish_${post_type}s&quot;);
</del><ins>+    $post_type_object = get_post_type_object($post_type);
+        $type_cap = $post_type_object-&gt;capability_type;
+        $can_publish = current_user_can(&quot;publish_${type_cap}s&quot;);
</ins><span class="cx"> ?&gt;
</span><span class="cx"> &lt;div class=&quot;submitbox&quot; id=&quot;submitpost&quot;&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -184,7 +186,7 @@
</span><span class="cx"> &lt;?php do_action('post_submitbox_start'); ?&gt;
</span><span class="cx"> &lt;div id=&quot;delete-action&quot;&gt;
</span><span class="cx"> &lt;?php
</span><del>-if ( current_user_can( &quot;delete_${post_type}&quot;, $post-&gt;ID ) ) {
</del><ins>+if ( current_user_can( &quot;delete_${type_cap}&quot;, $post-&gt;ID ) ) {
</ins><span class="cx">         if ( !EMPTY_TRASH_DAYS ) {
</span><span class="cx">                 $delete_url = wp_nonce_url( add_query_arg( array('action' =&gt; 'delete', 'post' =&gt; $post-&gt;ID) ), &quot;delete-${post_type}_{$post-&gt;ID}&quot; );
</span><span class="cx">                 $delete_text = __('Delete Permanently');
</span></span></pre></div>
<a id="trunkwpadminincludespluginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/includes/plugin.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -745,14 +745,15 @@
</span><span class="cx">                         $parent = $_wp_real_parent_file[$parent];
</span><span class="cx">                 return $parent;
</span><span class="cx">         }
</span><del>-/*
</del><ins>+
+        /*
</ins><span class="cx">         if ( !empty ( $parent_file ) ) {
</span><span class="cx">                 if ( isset( $_wp_real_parent_file[$parent_file] ) )
</span><span class="cx">                         $parent_file = $_wp_real_parent_file[$parent_file];
</span><span class="cx"> 
</span><span class="cx">                 return $parent_file;
</span><span class="cx">         }
</span><del>-*/
</del><ins>+        */
</ins><span class="cx"> 
</span><span class="cx">         if ( $pagenow == 'admin.php' &amp;&amp; isset( $plugin_page ) ) {
</span><span class="cx">                 foreach ( (array)$menu as $parent_menu ) {
</span><span class="lines">@@ -782,7 +783,7 @@
</span><span class="cx">                 foreach ( $submenu[$parent] as $submenu_array ) {
</span><span class="cx">                         if ( isset( $_wp_real_parent_file[$parent] ) )
</span><span class="cx">                                 $parent = $_wp_real_parent_file[$parent];
</span><del>-                        if ( $submenu_array[2] == $pagenow ) {
</del><ins>+                        if ( $submenu_array[2] == $pagenow &amp;&amp; ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
</ins><span class="cx">                                 $parent_file = $parent;
</span><span class="cx">                                 return $parent;
</span><span class="cx">                         } else
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/includes/post.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -846,12 +846,17 @@
</span><span class="cx">                 $orderby = 'date';
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        $post_type_q = 'post_type=post';
+        if ( isset($q['post_type']) &amp;&amp; in_array( $q['post_type'], get_post_types( array('_show' =&gt; true) ) ) )
+                $post_type_q = 'post_type=' . $q['post_type'];
+
+
</ins><span class="cx">         $posts_per_page = (int) get_user_option( 'edit_per_page', 0, false );
</span><span class="cx">         if ( empty( $posts_per_page ) || $posts_per_page &lt; 1 )
</span><span class="cx">                 $posts_per_page = 15;
</span><span class="cx">         $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );
</span><span class="cx"> 
</span><del>-        wp(&quot;post_type=post&amp;$post_status_q&amp;posts_per_page=$posts_per_page&amp;order=$order&amp;orderby=$orderby&quot;);
</del><ins>+        wp(&quot;$post_type_q&amp;$post_status_q&amp;posts_per_page=$posts_per_page&amp;order=$order&amp;orderby=$orderby&quot;);
</ins><span class="cx"> 
</span><span class="cx">         return array($post_stati, $avail_post_stati);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/includes/template.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -3482,7 +3482,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function screen_meta($screen) {
</span><del>-        global $wp_meta_boxes, $_wp_contextual_help;
</del><ins>+        global $wp_meta_boxes, $_wp_contextual_help, $typenow;
</ins><span class="cx"> 
</span><span class="cx">         $screen = str_replace('.php', '', $screen);
</span><span class="cx">         $screen = str_replace('-new', '', $screen);
</span><span class="lines">@@ -3492,6 +3492,12 @@
</span><span class="cx">         $column_screens = get_column_headers($screen);
</span><span class="cx">         $meta_screens = array('index' =&gt; 'dashboard');
</span><span class="cx"> 
</span><ins>+        // Give post_type pages their own screen
+        if ( 'post' == $screen ) {
+                if ( !empty($typenow) )
+                        $screen = $typenow;
+        }
+
</ins><span class="cx">         if ( isset($meta_screens[$screen]) )
</span><span class="cx">                 $screen = $meta_screens[$screen];
</span><span class="cx">         $show_screen = false;
</span><span class="lines">@@ -3675,6 +3681,11 @@
</span><span class="cx">         global $screen_layout_columns;
</span><span class="cx"> 
</span><span class="cx">         $columns = array('dashboard' =&gt; 4, 'post' =&gt; 2, 'page' =&gt; 2, 'link' =&gt; 2);
</span><ins>+
+        // Add custom post types
+        foreach ( get_post_types( array('_show' =&gt; true) ) as $post_type )
+                $columns[$post_type] = 2;
+
</ins><span class="cx">         $columns = apply_filters('screen_layout_columns', $columns, $screen);
</span><span class="cx"> 
</span><span class="cx">         if ( !isset($columns[$screen]) ) {
</span><span class="lines">@@ -3754,8 +3765,12 @@
</span><span class="cx">         global $parent_file, $hook_suffix;
</span><span class="cx"> 
</span><span class="cx">         if ( empty($name) ) {
</span><del>-                if ( isset($parent_file) &amp;&amp; !empty($parent_file) )
-                        $name = substr($parent_file, 0, -4);
</del><ins>+                if ( isset($parent_file) &amp;&amp; !empty($parent_file) ) {
+                        $name = $parent_file;
+                        if ( false !== $pos = strpos($name, '?post_type=') )
+                                $name = substr($name, 0, $pos);
+                        $name = substr($name, 0, -4);
+                }
</ins><span class="cx">                 else
</span><span class="cx">                         $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpadminjspostdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/post.dev.js (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/post.dev.js        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/js/post.dev.js        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -231,10 +231,14 @@
</span><span class="cx">         var catAddAfter, stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
</span><span class="cx"> 
</span><span class="cx">         // postboxes
</span><del>-        if ( post )
-                postboxes.add_postbox_toggles('post');
-        else if ( page )
</del><ins>+        if ( post ) {
+                type = 'post';
+                if ( typenow )
+                        type = typenow;
+                postboxes.add_postbox_toggles(type);
+        } else if ( page ) {
</ins><span class="cx">                 postboxes.add_postbox_toggles('page');
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         // multi-taxonomies
</span><span class="cx">         if ( $('#tagsdiv-post_tag').length ) {
</span></span></pre></div>
<a id="trunkwpadminjspostjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/post.js (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/post.js        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/js/post.js        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&amp;&amp;jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,&quot;,&quot;).replace(/,+/g,&quot;,&quot;).replace(/[,\s]+$/,&quot;&quot;).replace(/^[,\s]+/,&quot;&quot;)},parseTags:function(e){var h=e.id,b=h.split(&quot;-check-num-&quot;)[1],d=a(e).closest(&quot;.tagsdiv&quot;),g=d.find(&quot;.the-tags&quot;),c=g.val().split(&quot;,&quot;),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(&quot;,&quot;)));this.quickClicks(d);return false},quickClicks:function(c){var e=a(&quot;.the-tags&quot;,c),d=a(&quot;.tagchecklist&quot;,c),b;if(!e.length){return}b=e.val().split(&quot;,&quot;);d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr(&quot;id&quot;);i=a.trim(i);if(!i.match(/^\s+$/)&amp;&amp;&quot;&quot;!=i){g=j+&quot;-check-num-&quot;+h;f='&lt;span&gt;&lt;a id=&quot;'+g+'&quot; class=&quot;ntdelbutton&quot;&gt;X&lt;/a&gt;&amp;nbsp;'+i+&quot;&lt;/span&gt; &quot;;d.append(f);a(&quot;#&quot;+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(&quot;.the-tags&quot;,e),h=a(&quot;input.newtag&quot;,e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+&quot;,&quot;+i:i;d=this.clean(d);d=array_unique_noempty(d.split(&quot;,&quot;)).join(&quot;,&quot;);c.val(d);this.quickClicks(e);if(!b){h.val(&quot;&quot;)}if(&quot;undefined&quot;==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf(&quot;-&quot;)+1);a.post(ajaxurl,{action:&quot;get-tagcloud&quot;,tax:b},function(e,d){if(0==e||&quot;success&quot;!=d){e=wpAjax.broken}e=a('&lt;p id=&quot;tagcloud-'+b+'&quot; class=&quot;the-tagcloud&quot;&gt;'+e+&quot;&lt;/p&gt;&quot;);a(&quot;a&quot;,e).click(function(){tagBox.flushTags(a(this).closest(&quot;.inside&quot;).children(&quot;.tagsdiv&quot;),this);return false});a(&quot;#&quot;+c).after(e)})},init:function(){var b=this,c=a(&quot;div.ajaxtag&quot;);a(&quot;.tagsdiv&quot;).each(function(){tagBox.quickClicks(this)});a(&quot;input.tagadd&quot;,c).click(function(){b.flushTags(a(this).closest(&quot;.tagsdiv&quot;))});a(&quot;div.taghint&quot;,c).click(function(){a(this).css(&quot;visibility&quot;,&quot;hidden&quot;).siblings(&quot;.newtag&quot;).focus()});a(&quot;input.newtag&quot;,c).blur(function(){if(this.value==&quot;&quot;){a(this).siblings(&quot;.taghint&quot;).css(&quot;visibility&quot;,&quot;&quot;)}}).focus(function(){a(this).siblings(&quot;.taghint&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(&quot;.tagsdiv&quot;));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest(&quot;div.tagsdiv&quot;).attr(&quot;id&quot;);a(this).suggest(ajaxurl+&quot;?action=ajax-tag-search&amp;tax=&quot;+d,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})});a(&quot;#post&quot;).submit(function(){a(&quot;div.tagsdiv&quot;).each(function(){tagBox.flushTags(this,false,1)})});a(&quot;a.tagcloud-link&quot;).click(function(){tagBox.get(a(this).attr(&quot;id&quot;));a(this).unbind().click(function(){a(this).siblings(&quot;.the-tagcloud&quot;).toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a(&quot;#commentsdiv img.waiting&quot;).show();e={action:&quot;get-comments&quot;,mode:&quot;single&quot;,_ajax_nonce:a(&quot;#add_comment_nonce&quot;).val(),post_ID:a(&quot;#post_ID&quot;).val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a(&quot;#commentsdiv .widefat&quot;).show();a(&quot;#commentsdiv img.waiting&quot;).hide();if(&quot;object&quot;==typeof f&amp;&amp;f.responses[0]){a(&quot;#the-comment-list&quot;).append(f.responses[0].data);theList=theExtraList=null;a(&quot;a[className*=':']&quot;).unbind();setCommentsList();if(commentsBox.st&gt;commentsBox.total){a(&quot;#show-comments&quot;).hide()}else{a(&quot;#show-comments&quot;).html(postL10n.showcomm)}return}else{if(1==f){a(&quot;#show-comments&quot;).parent().html(postL10n.endcomm);return}}a(&quot;#the-comment-list&quot;).append('&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;'+wpAjax.broken+&quot;&lt;/td&gt;&lt;/tr&gt;&quot;)});return false}};WPSetThumbnailHTML=function(b){a(&quot;.inside&quot;,&quot;#postimagediv&quot;).html(b)};WPSetThumbnailID=function(c){var b=a(&quot;input[value=_thumbnail_id]&quot;,&quot;#list-table&quot;);if(b.size()&gt;0){a(&quot;#meta\\[&quot;+b.attr(&quot;id&quot;).match(/[0-9]+/)+&quot;\\]\\[value\\]&quot;).text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:&quot;set-post-thumbnail&quot;,post_id:a(&quot;#post_ID&quot;).val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b==&quot;0&quot;){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(f){var d,a,b,h=&quot;&quot;,i=&quot;post&quot;==pagenow||&quot;post-new&quot;==pagenow,g=&quot;page&quot;==pagenow||&quot;page-new&quot;==pagenow;if(i){postboxes.add_postbox_toggles(&quot;post&quot;)}else{if(g){postboxes.add_postbox_toggles(&quot;page&quot;)}}if(f(&quot;#tagsdiv-post_tag&quot;).length){tagBox.init()}else{f(&quot;#side-sortables, #normal-sortables, #advanced-sortables&quot;).children(&quot;div.postbox&quot;).each(function(){if(this.id.indexOf(&quot;tagsdiv-&quot;)===0){tagBox.init();return false}})}if(f(&quot;#categorydiv&quot;).length){f(&quot;a&quot;,&quot;#category-tabs&quot;).click(function(){var j=f(this).attr(&quot;href&quot;);f(this).parent().addClass(&quot;tabs&quot;).siblings(&quot;li&quot;).removeClass(&quot;tabs&quot;);f(&quot;#category-tabs&quot;).siblings(&quot;.tabs-panel&quot;).hide();f(j).show();if(&quot;#categories-all&quot;==j){deleteUserSetting(&quot;cats&quot;)}else{setUserSetting(&quot;cats&quot;,&quot;pop&quot;)}return false});if(getUserSetting(&quot;cats&quot;)){f('a[href=&quot;#categories-pop&quot;]',&quot;#category-tabs&quot;).click()}f(&quot;#newcat&quot;).one(&quot;focus&quot;,function(){f(this).val(&quot;&quot;).removeClass(&quot;form-input-tip&quot;)});f(&quot;#category-add-sumbit&quot;).click(function(){f(&quot;#newcat&quot;).focus()});catAddBefore=function(j){if(!f(&quot;#newcat&quot;).val()){return false}j.data+=&quot;&amp;&quot;+f(&quot;:checked&quot;,&quot;#categorychecklist&quot;).serialize();return j};d=function(m,l){var k,j=f(&quot;#newcat_parent&quot;);if(&quot;undefined&quot;!=l.parsed.responses[0]&amp;&amp;(k=l.parsed.responses[0].supplemental.newcat_parent)){j.before(k);j.remove()}};f(&quot;#categorychecklist&quot;).wpList({alt:&quot;&quot;,response:&quot;category-ajax-response&quot;,addBefore:catAddBefore,addAfter:d});f(&quot;#category-add-toggle&quot;).click(function(){f(&quot;#category-adder&quot;).toggleClass(&quot;wp-hidden-children&quot;);f('a[href=&quot;#categories-all&quot;]',&quot;#category-tabs&quot;).click();return false});f(&quot;#categorychecklist&quot;).children(&quot;li.popular-category&quot;).add(f(&quot;#categorychecklist-pop&quot;).children()).find(&quot;:checkbox&quot;).live(&quot;click&quot;,function(){var j=f(this),l=j.is(&quot;:checked&quot;),k=j.val();f(&quot;#in-category-&quot;+k+&quot;, #in-popular-category-&quot;+k).attr(&quot;checked&quot;,l)})}if(f(&quot;#postcustom&quot;).length){f(&quot;#the-list&quot;).wpList({addAfter:function(j,k){f(&quot;table#list-table&quot;).show();if(typeof(autosave_update_post_ID)!=&quot;undefined&quot;){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+=&quot;&amp;post_id=&quot;+f(&quot;#post_ID&quot;).val();return j}})}if(f(&quot;#submitdiv&quot;).length){a=f(&quot;#timestamp&quot;).html();b=f(&quot;#post-visibility-display&quot;).html();function e(){var j=f(&quot;#post-visibility-select&quot;);if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;public&quot;){f(&quot;#sticky&quot;).attr(&quot;checked&quot;,false);f(&quot;#sticky-span&quot;).hide()}else{f(&quot;#sticky-span&quot;).show()}if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;password&quot;){f(&quot;#password-span&quot;).hide()}else{f(&quot;#password-span&quot;).show()}}function c(){var q,r,k,t,s=f(&quot;#post_status&quot;),l=f(&quot;option[value=publish]&quot;,s),j=f(&quot;#aa&quot;).val(),o=f(&quot;#mm&quot;).val(),p=f(&quot;#jj&quot;).val(),n=f(&quot;#hh&quot;).val(),m=f(&quot;#mn&quot;).val();q=new Date(j,o-1,p,n,m);r=new Date(f(&quot;#hidden_aa&quot;).val(),f(&quot;#hidden_mm&quot;).val()-1,f(&quot;#hidden_jj&quot;).val(),f(&quot;#hidden_hh&quot;).val(),f(&quot;#hidden_mn&quot;).val());k=new Date(f(&quot;#cur_aa&quot;).val(),f(&quot;#cur_mm&quot;).val()-1,f(&quot;#cur_jj&quot;).val(),f(&quot;#cur_hh&quot;).val(),f(&quot;#cur_mn&quot;).val());if(q.getFullYear()!=j||(1+q.getMonth())!=o||q.getDate()!=p||q.getMinutes()!=m){f(&quot;.timestamp-wrap&quot;,&quot;#timestampdiv&quot;).addClass(&quot;form-invalid&quot;);return false}else{f(&quot;.timestamp-wrap&quot;,&quot;#timestampdiv&quot;).removeClass(&quot;form-invalid&quot;)}if(q&gt;k&amp;&amp;f(&quot;#original_post_status&quot;).val()!=&quot;future&quot;){t=postL10n.publishOnFuture;f(&quot;#publish&quot;).val(postL10n.schedule)}else{if(q&lt;=k&amp;&amp;f(&quot;#original_post_status&quot;).val()!=&quot;publish&quot;){t=postL10n.publishOn;f(&quot;#publish&quot;).val(postL10n.publish)}else{t=postL10n.publishOnPast;if(g){f(&quot;#publish&quot;).val(postL10n.updatePage)}else{f(&quot;#publish&quot;).val(postL10n.updatePost)}}}if(r.toUTCString()==q.toUTCString()){f(&quot;#timestamp&quot;).html(a)}else{f(&quot;#timestamp&quot;).html(t+&quot; &lt;b&gt;&quot;+f(&quot;option[value=&quot;+f(&quot;#mm&quot;).val()+&quot;]&quot;,&quot;#mm&quot;).text()+&quot; &quot;+p+&quot;, &quot;+j+&quot; @ &quot;+n+&quot;:&quot;+m+&quot;&lt;/b&gt; &quot;)}if(f(&quot;input:radio:checked&quot;,&quot;#post-visibility-select&quot;).val()==&quot;private&quot;){if(g){f(&quot;#publish&quot;).val(postL10n.updatePage)}else{f(&quot;#publish&quot;).val(postL10n.updatePost)}if(l.length==0){s.append('&lt;option value=&quot;publish&quot;&gt;'+postL10n.privatelyPublished+&quot;&lt;/option&gt;&quot;)}else{l.html(postL10n.privatelyPublished)}f(&quot;option[value=publish]&quot;,s).attr(&quot;selected&quot;,true);f(&quot;.edit-post-status&quot;,&quot;#misc-publishing-actions&quot;).hide()}else{if(f(&quot;#original_post_status&quot;).val()==&quot;future&quot;||f(&quot;#original_post_status&quot;).val()==&quot;draft&quot;){if(l.length){l.remove();s.val(f(&quot;#hidden_post_status&quot;).val())}}else{l.html(postL10n.published)}if(s.is(&quot;:hidden&quot;)){f(&quot;.edit-post-status&quot;,&quot;#misc-publishing-actions&quot;).show()}}f(&quot;#post-status-display&quot;).html(f(&quot;option:selected&quot;,s).text());if(f(&quot;option:selected&quot;,s).val()==&quot;private&quot;||f(&quot;option:selected&quot;,s).val()==&quot;publish&quot;){f(&quot;#save-post&quot;).hide()}else{f(&quot;#save-post&quot;).show();if(f(&quot;option:selected&quot;,s).val()==&quot;pending&quot;){f(&quot;#save-post&quot;).show().val(postL10n.savePending)}else{f(&quot;#save-post&quot;).show().val(postL10n.saveDraft)}}return true}f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).click(function(){if(f(&quot;#post-visibility-select&quot;).is(&quot;:hidden&quot;)){e();f(&quot;#post-visibility-select&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.cancel-post-visibility&quot;,&quot;#post-visibility-select&quot;).click(function(){f(&quot;#post-visibility-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#visibility-radio-&quot;+f(&quot;#hidden-post-visibility&quot;).val()).attr(&quot;checked&quot;,true);f(&quot;#post_password&quot;).val(f(&quot;#hidden_post_password&quot;).val());f(&quot;#sticky&quot;).attr(&quot;checked&quot;,f(&quot;#hidden-post-sticky&quot;).attr(&quot;checked&quot;));f(&quot;#post-visibility-display&quot;).html(b);f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).show();c();return false});f(&quot;.save-post-visibility&quot;,&quot;#post-visibility-select&quot;).click(function(){var j=f(&quot;#post-visibility-select&quot;);j.slideUp(&quot;normal&quot;);f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).show();c();if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;public&quot;){f(&quot;#sticky&quot;).attr(&quot;checked&quot;,false)}if(true==f(&quot;#sticky&quot;).attr(&quot;checked&quot;)){h=&quot;Sticky&quot;}else{h=&quot;&quot;}f(&quot;#post-visibility-display&quot;).html(postL10n[f(&quot;input:radio:checked&quot;,j).val()+h]);return false});f(&quot;input:radio&quot;,&quot;#post-visibility-select&quot;).change(function(){e()});f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).click(function(){if(f(&quot;#timestampdiv&quot;).is(&quot;:hidden&quot;)){f(&quot;#timestampdiv&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.cancel-timestamp&quot;,&quot;#timestampdiv&quot;).click(function(){f(&quot;#timestampdiv&quot;).slideUp(&quot;normal&quot;);f(&quot;#mm&quot;).val(f(&quot;#hidden_mm&quot;).val());f(&quot;#jj&quot;).val(f(&quot;#hidden_jj&quot;).val());f(&quot;#aa&quot;).val(f(&quot;#hidden_aa&quot;).val());f(&quot;#hh&quot;).val(f(&quot;#hidden_hh&quot;).val());f(&quot;#mn&quot;).val(f(&quot;#hidden_mn&quot;).val());f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).show();c();return false});f(&quot;.save-timestamp&quot;,&quot;#timestampdiv&quot;).click(function(){if(c()){f(&quot;#timestampdiv&quot;).slideUp(&quot;normal&quot;);f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).show()}return false});f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).click(function(){if(f(&quot;#post-status-select&quot;).is(&quot;:hidden&quot;)){f(&quot;#post-status-select&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.save-post-status&quot;,&quot;#post-status-select&quot;).click(function(){f(&quot;#post-status-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).show();c();return false});f(&quot;.cancel-post-status&quot;,&quot;#post-status-select&quot;).click(function(){f(&quot;#post-status-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#post_status&quot;).val(f(&quot;#hidden_post_status&quot;).val());f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).show();c();return false})}if(f(&quot;#edit-slug-box&quot;).length){editPermalink=function(j){var k,n=0,m=f(&quot;#editable-post-name&quot;),o=m.html(),r=f(&quot;#post_name&quot;),s=r.html(),p=f(&quot;#edit-slug-buttons&quot;),q=p.html(),l=f(&quot;#editable-post-name-full&quot;).html();f(&quot;#view-post-btn&quot;).hide();p.html('&lt;a href=&quot;#&quot; class=&quot;save button&quot;&gt;'+postL10n.ok+'&lt;/a&gt; &lt;a class=&quot;cancel&quot; href=&quot;#&quot;&gt;'+postL10n.cancel+&quot;&lt;/a&gt;&quot;);p.children(&quot;.save&quot;).click(function(){var t=m.children(&quot;input&quot;).val();f.post(ajaxurl,{action:&quot;sample-permalink&quot;,post_id:j,new_slug:t,new_title:f(&quot;#title&quot;).val(),samplepermalinknonce:f(&quot;#samplepermalinknonce&quot;).val()},function(u){f(&quot;#edit-slug-box&quot;).html(u);p.html(q);r.attr(&quot;value&quot;,t);makeSlugeditClickable();f(&quot;#view-post-btn&quot;).show()});return false});f(&quot;.cancel&quot;,&quot;#edit-slug-buttons&quot;).click(function(){f(&quot;#view-post-btn&quot;).show();m.html(o);p.html(q);r.attr(&quot;value&quot;,s);return false});for(k=0;k&lt;l.length;++k){if(&quot;%&quot;==l.charAt(k)){n++}}slug_value=(n&gt;l.length/4)?&quot;&quot;:l;m.html('&lt;input type=&quot;text&quot; id=&quot;new-post-slug&quot; value=&quot;'+slug_value+'&quot; /&gt;').children(&quot;input&quot;).keypress(function(u){var t=u.keyCode||0;if(13==t){p.children(&quot;.save&quot;).click();return false}if(27==t){p.children(&quot;.cancel&quot;).click();return false}r.attr(&quot;value&quot;,this.value)}).focus()};makeSlugeditClickable=function(){f(&quot;#editable-post-name&quot;).click(function(){f(&quot;#edit-slug-buttons&quot;).children(&quot;.edit-slug&quot;).click()})};makeSlugeditClickable()}});
</del><span class="cx">\ No newline at end of file
</span><ins>+var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&amp;&amp;jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,&quot;,&quot;).replace(/,+/g,&quot;,&quot;).replace(/[,\s]+$/,&quot;&quot;).replace(/^[,\s]+/,&quot;&quot;)},parseTags:function(e){var h=e.id,b=h.split(&quot;-check-num-&quot;)[1],d=a(e).closest(&quot;.tagsdiv&quot;),g=d.find(&quot;.the-tags&quot;),c=g.val().split(&quot;,&quot;),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(&quot;,&quot;)));this.quickClicks(d);return false},quickClicks:function(c){var e=a(&quot;.the-tags&quot;,c),d=a(&quot;.tagchecklist&quot;,c),b;if(!e.length){return}b=e.val().split(&quot;,&quot;);d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr(&quot;id&quot;);i=a.trim(i);if(!i.match(/^\s+$/)&amp;&amp;&quot;&quot;!=i){g=j+&quot;-check-num-&quot;+h;f='&lt;span&gt;&lt;a id=&quot;'+g+'&quot; class=&quot;ntdelbutton&quot;&gt;X&lt;/a&gt;&amp;nbsp;'+i+&quot;&lt;/span&gt; &quot;;d.append(f);a(&quot;#&quot;+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(&quot;.the-tags&quot;,e),h=a(&quot;input.newtag&quot;,e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+&quot;,&quot;+i:i;d=this.clean(d);d=array_unique_noempty(d.split(&quot;,&quot;)).join(&quot;,&quot;);c.val(d);this.quickClicks(e);if(!b){h.val(&quot;&quot;)}if(&quot;undefined&quot;==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf(&quot;-&quot;)+1);a.post(ajaxurl,{action:&quot;get-tagcloud&quot;,tax:b},function(e,d){if(0==e||&quot;success&quot;!=d){e=wpAjax.broken}e=a('&lt;p id=&quot;tagcloud-'+b+'&quot; class=&quot;the-tagcloud&quot;&gt;'+e+&quot;&lt;/p&gt;&quot;);a(&quot;a&quot;,e).click(function(){tagBox.flushTags(a(this).closest(&quot;.inside&quot;).children(&quot;.tagsdiv&quot;),this);return false});a(&quot;#&quot;+c).after(e)})},init:function(){var b=this,c=a(&quot;div.ajaxtag&quot;);a(&quot;.tagsdiv&quot;).each(function(){tagBox.quickClicks(this)});a(&quot;input.tagadd&quot;,c).click(function(){b.flushTags(a(this).closest(&quot;.tagsdiv&quot;))});a(&quot;div.taghint&quot;,c).click(function(){a(this).css(&quot;visibility&quot;,&quot;hidden&quot;).siblings(&quot;.newtag&quot;).focus()});a(&quot;input.newtag&quot;,c).blur(function(){if(this.value==&quot;&quot;){a(this).siblings(&quot;.taghint&quot;).css(&quot;visibility&quot;,&quot;&quot;)}}).focus(function(){a(this).siblings(&quot;.taghint&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(&quot;.tagsdiv&quot;));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest(&quot;div.tagsdiv&quot;).attr(&quot;id&quot;);a(this).suggest(ajaxurl+&quot;?action=ajax-tag-search&amp;tax=&quot;+d,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})});a(&quot;#post&quot;).submit(function(){a(&quot;div.tagsdiv&quot;).each(function(){tagBox.flushTags(this,false,1)})});a(&quot;a.tagcloud-link&quot;).click(function(){tagBox.get(a(this).attr(&quot;id&quot;));a(this).unbind().click(function(){a(this).siblings(&quot;.the-tagcloud&quot;).toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a(&quot;#commentsdiv img.waiting&quot;).show();e={action:&quot;get-comments&quot;,mode:&quot;single&quot;,_ajax_nonce:a(&quot;#add_comment_nonce&quot;).val(),post_ID:a(&quot;#post_ID&quot;).val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a(&quot;#commentsdiv .widefat&quot;).show();a(&quot;#commentsdiv img.waiting&quot;).hide();if(&quot;object&quot;==typeof f&amp;&amp;f.responses[0]){a(&quot;#the-comment-list&quot;).append(f.responses[0].data);theList=theExtraList=null;a(&quot;a[className*=':']&quot;).unbind();setCommentsList();if(commentsBox.st&gt;commentsBox.total){a(&quot;#show-comments&quot;).hide()}else{a(&quot;#show-comments&quot;).html(postL10n.showcomm)}return}else{if(1==f){a(&quot;#show-comments&quot;).parent().html(postL10n.endcomm);return}}a(&quot;#the-comment-list&quot;).append('&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;'+wpAjax.broken+&quot;&lt;/td&gt;&lt;/tr&gt;&quot;)});return false}};WPSetThumbnailHTML=function(b){a(&quot;.inside&quot;,&quot;#postimagediv&quot;).html(b)};WPSetThumbnailID=function(c){var b=a(&quot;input[value=_thumbnail_id]&quot;,&quot;#list-table&quot;);if(b.size()&gt;0){a(&quot;#meta\\[&quot;+b.attr(&quot;id&quot;).match(/[0-9]+/)+&quot;\\]\\[value\\]&quot;).text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:&quot;set-post-thumbnail&quot;,post_id:a(&quot;#post_ID&quot;).val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b==&quot;0&quot;){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(f){var d,a,b,h=&quot;&quot;,i=&quot;post&quot;==pagenow||&quot;post-new&quot;==pagenow,g=&quot;page&quot;==pagenow||&quot;page-new&quot;==pagenow;if(i){type=&quot;post&quot;;if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(g){postboxes.add_postbox_toggles(&quot;page&quot;)}}if(f(&quot;#tagsdiv-post_tag&quot;).length){tagBox.init()}else{f(&quot;#side-sortables, #normal-sortables, #advanced-sortables&quot;).children(&quot;div.postbox&quot;).each(function(){if(this.id.indexOf(&quot;tagsdiv-&quot;)===0){tagBox.init();return false}})}if(f(&quot;#categorydiv&quot;).length){f(&quot;a&quot;,&quot;#category-tabs&quot;).click(function(){var j=f(this).attr(&quot;href&quot;);f(this).parent().addClass(&quot;tabs&quot;).siblings(&quot;li&quot;).removeClass(&quot;tabs&quot;);f(&quot;#category-tabs&quot;).siblings(&quot;.tabs-panel&quot;).hide();f(j).show();if(&quot;#categories-all&quot;==j){deleteUserSetting(&quot;cats&quot;)}else{setUserSetting(&quot;cats&quot;,&quot;pop&quot;)}return false});if(getUserSetting(&quot;cats&quot;)){f('a[href=&quot;#categories-pop&quot;]',&quot;#category-tabs&quot;).click()}f(&quot;#newcat&quot;).one(&quot;focus&quot;,function(){f(this).val(&quot;&quot;).removeClass(&quot;form-input-tip&quot;)});f(&quot;#category-add-sumbit&quot;).click(function(){f(&quot;#newcat&quot;).focus()});catAddBefore=function(j){if(!f(&quot;#newcat&quot;).val()){return false}j.data+=&quot;&amp;&quot;+f(&quot;:checked&quot;,&quot;#categorychecklist&quot;).serialize();return j};d=function(m,l){var k,j=f(&quot;#newcat_parent&quot;);if(&quot;undefined&quot;!=l.parsed.responses[0]&amp;&amp;(k=l.parsed.responses[0].supplemental.newcat_parent)){j.before(k);j.remove()}};f(&quot;#categorychecklist&quot;).wpList({alt:&quot;&quot;,response:&quot;category-ajax-response&quot;,addBefore:catAddBefore,addAfter:d});f(&quot;#category-add-toggle&quot;).click(function(){f(&quot;#category-adder&quot;).toggleClass(&quot;wp-hidden-children&quot;);f('a[href=&quot;#categories-all&quot;]',&quot;#category-tabs&quot;).click();return false});f(&quot;#categorychecklist&quot;).children(&quot;li.popular-category&quot;).add(f(&quot;#categorychecklist-pop&quot;).children()).find(&quot;:checkbox&quot;).live(&quot;click&quot;,function(){var j=f(this),l=j.is(&quot;:checked&quot;),k=j.val();f(&quot;#in-category-&quot;+k+&quot;, #in-popular-category-&quot;+k).attr(&quot;checked&quot;,l)})}if(f(&quot;#postcustom&quot;).length){f(&quot;#the-list&quot;).wpList({addAfter:function(j,k){f(&quot;table#list-table&quot;).show();if(typeof(autosave_update_post_ID)!=&quot;undefined&quot;){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+=&quot;&amp;post_id=&quot;+f(&quot;#post_ID&quot;).val();return j}})}if(f(&quot;#submitdiv&quot;).length){a=f(&quot;#timestamp&quot;).html();b=f(&quot;#post-visibility-display&quot;).html();function e(){var j=f(&quot;#post-visibility-select&quot;);if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;public&quot;){f(&quot;#sticky&quot;).attr(&quot;checked&quot;,false);f(&quot;#sticky-span&quot;).hide()}else{f(&quot;#sticky-span&quot;).show()}if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;password&quot;){f(&quot;#password-span&quot;).hide()}else{f(&quot;#password-span&quot;).show()}}function c(){var q,r,k,t,s=f(&quot;#post_status&quot;),l=f(&quot;option[value=publish]&quot;,s),j=f(&quot;#aa&quot;).val(),o=f(&quot;#mm&quot;).val(),p=f(&quot;#jj&quot;).val(),n=f(&quot;#hh&quot;).val(),m=f(&quot;#mn&quot;).val();q=new Date(j,o-1,p,n,m);r=new Date(f(&quot;#hidden_aa&quot;).val(),f(&quot;#hidden_mm&quot;).val()-1,f(&quot;#hidden_jj&quot;).val(),f(&quot;#hidden_hh&quot;).val(),f(&quot;#hidden_mn&quot;).val());k=new Date(f(&quot;#cur_aa&quot;).val(),f(&quot;#cur_mm&quot;).val()-1,f(&quot;#cur_jj&quot;).val(),f(&quot;#cur_hh&quot;).val(),f(&quot;#cur_mn&quot;).val());if(q.getFullYear()!=j||(1+q.getMonth())!=o||q.getDate()!=p||q.getMinutes()!=m){f(&quot;.timestamp-wrap&quot;,&quot;#timestampdiv&quot;).addClass(&quot;form-invalid&quot;);return false}else{f(&quot;.timestamp-wrap&quot;,&quot;#timestampdiv&quot;).removeClass(&quot;form-invalid&quot;)}if(q&gt;k&amp;&amp;f(&quot;#original_post_status&quot;).val()!=&quot;future&quot;){t=postL10n.publishOnFuture;f(&quot;#publish&quot;).val(postL10n.schedule)}else{if(q&lt;=k&amp;&amp;f(&quot;#original_post_status&quot;).val()!=&quot;publish&quot;){t=postL10n.publishOn;f(&quot;#publish&quot;).val(postL10n.publish)}else{t=postL10n.publishOnPast;if(g){f(&quot;#publish&quot;).val(postL10n.updatePage)}else{f(&quot;#publish&quot;).val(postL10n.updatePost)}}}if(r.toUTCString()==q.toUTCString()){f(&quot;#timestamp&quot;).html(a)}else{f(&quot;#timestamp&quot;).html(t+&quot; &lt;b&gt;&quot;+f(&quot;option[value=&quot;+f(&quot;#mm&quot;).val()+&quot;]&quot;,&quot;#mm&quot;).text()+&quot; &quot;+p+&quot;, &quot;+j+&quot; @ &quot;+n+&quot;:&quot;+m+&quot;&lt;/b&gt; &quot;)}if(f(&quot;input:radio:checked&quot;,&quot;#post-visibility-select&quot;).val()==&quot;private&quot;){if(g){f(&quot;#publish&quot;).val(postL10n.updatePage)}else{f(&quot;#publish&quot;).val(postL10n.updatePost)}if(l.length==0){s.append('&lt;option value=&quot;publish&quot;&gt;'+postL10n.privatelyPublished+&quot;&lt;/option&gt;&quot;)}else{l.html(postL10n.privatelyPublished)}f(&quot;option[value=publish]&quot;,s).attr(&quot;selected&quot;,true);f(&quot;.edit-post-status&quot;,&quot;#misc-publishing-actions&quot;).hide()}else{if(f(&quot;#original_post_status&quot;).val()==&quot;future&quot;||f(&quot;#original_post_status&quot;).val()==&quot;draft&quot;){if(l.length){l.remove();s.val(f(&quot;#hidden_post_status&quot;).val())}}else{l.html(postL10n.published)}if(s.is(&quot;:hidden&quot;)){f(&quot;.edit-post-status&quot;,&quot;#misc-publishing-actions&quot;).show()}}f(&quot;#post-status-display&quot;).html(f(&quot;option:selected&quot;,s).text());if(f(&quot;option:selected&quot;,s).val()==&quot;private&quot;||f(&quot;option:selected&quot;,s).val()==&quot;publish&quot;){f(&quot;#save-post&quot;).hide()}else{f(&quot;#save-post&quot;).show();if(f(&quot;option:selected&quot;,s).val()==&quot;pending&quot;){f(&quot;#save-post&quot;).show().val(postL10n.savePending)}else{f(&quot;#save-post&quot;).show().val(postL10n.saveDraft)}}return true}f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).click(function(){if(f(&quot;#post-visibility-select&quot;).is(&quot;:hidden&quot;)){e();f(&quot;#post-visibility-select&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.cancel-post-visibility&quot;,&quot;#post-visibility-select&quot;).click(function(){f(&quot;#post-visibility-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#visibility-radio-&quot;+f(&quot;#hidden-post-visibility&quot;).val()).attr(&quot;checked&quot;,true);f(&quot;#post_password&quot;).val(f(&quot;#hidden_post_password&quot;).val());f(&quot;#sticky&quot;).attr(&quot;checked&quot;,f(&quot;#hidden-post-sticky&quot;).attr(&quot;checked&quot;));f(&quot;#post-visibility-display&quot;).html(b);f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).show();c();return false});f(&quot;.save-post-visibility&quot;,&quot;#post-visibility-select&quot;).click(function(){var j=f(&quot;#post-visibility-select&quot;);j.slideUp(&quot;normal&quot;);f(&quot;.edit-visibility&quot;,&quot;#visibility&quot;).show();c();if(f(&quot;input:radio:checked&quot;,j).val()!=&quot;public&quot;){f(&quot;#sticky&quot;).attr(&quot;checked&quot;,false)}if(true==f(&quot;#sticky&quot;).attr(&quot;checked&quot;)){h=&quot;Sticky&quot;}else{h=&quot;&quot;}f(&quot;#post-visibility-display&quot;).html(postL10n[f(&quot;input:radio:checked&quot;,j).val()+h]);return false});f(&quot;input:radio&quot;,&quot;#post-visibility-select&quot;).change(function(){e()});f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).click(function(){if(f(&quot;#timestampdiv&quot;).is(&quot;:hidden&quot;)){f(&quot;#timestampdiv&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.cancel-timestamp&quot;,&quot;#timestampdiv&quot;).click(function(){f(&quot;#timestampdiv&quot;).slideUp(&quot;normal&quot;);f(&quot;#mm&quot;).val(f(&quot;#hidden_mm&quot;).val());f(&quot;#jj&quot;).val(f(&quot;#hidden_jj&quot;).val());f(&quot;#aa&quot;).val(f(&quot;#hidden_aa&quot;).val());f(&quot;#hh&quot;).val(f(&quot;#hidden_hh&quot;).val());f(&quot;#mn&quot;).val(f(&quot;#hidden_mn&quot;).val());f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).show();c();return false});f(&quot;.save-timestamp&quot;,&quot;#timestampdiv&quot;).click(function(){if(c()){f(&quot;#timestampdiv&quot;).slideUp(&quot;normal&quot;);f(&quot;#timestampdiv&quot;).siblings(&quot;a.edit-timestamp&quot;).show()}return false});f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).click(function(){if(f(&quot;#post-status-select&quot;).is(&quot;:hidden&quot;)){f(&quot;#post-status-select&quot;).slideDown(&quot;normal&quot;);f(this).hide()}return false});f(&quot;.save-post-status&quot;,&quot;#post-status-select&quot;).click(function(){f(&quot;#post-status-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).show();c();return false});f(&quot;.cancel-post-status&quot;,&quot;#post-status-select&quot;).click(function(){f(&quot;#post-status-select&quot;).slideUp(&quot;normal&quot;);f(&quot;#post_status&quot;).val(f(&quot;#hidden_post_status&quot;).val());f(&quot;#post-status-select&quot;).siblings(&quot;a.edit-post-status&quot;).show();c();return false})}if(f(&quot;#edit-slug-box&quot;).length){editPermalink=function(j){var k,n=0,m=f(&quot;#editable-post-name&quot;),o=m.html(),r=f(&quot;#post_name&quot;),s=r.html(),p=f(&quot;#edit-slug-buttons&quot;),q=p.html(),l=f(&quot;#editable-post-name-full&quot;).html();f(&quot;#view-post-btn&quot;).hide();p.html('&lt;a href=&quot;#&quot; class=&quot;save button&quot;&gt;'+postL10n.ok+'&lt;/a&gt; &lt;a class=&quot;cancel&quot; href=&quot;#&quot;&gt;'+postL10n.cancel+&quot;&lt;/a&gt;&quot;);p.children(&quot;.save&quot;).click(function(){var t=m.children(&quot;input&quot;).val();f.post(ajaxurl,{action:&quot;sample-permalink&quot;,post_id:j,new_slug:t,new_title:f(&quot;#title&quot;).val(),samplepermalinknonce:f(&quot;#samplepermalinknonce&quot;).val()},function(u){f(&quot;#edit-slug-box&quot;).html(u);p.html(q);r.attr(&quot;value&quot;,t);makeSlugeditClickable();f(&quot;#view-post-btn&quot;).show()});return false});f(&quot;.cancel&quot;,&quot;#edit-slug-buttons&quot;).click(function(){f(&quot;#view-post-btn&quot;).show();m.html(o);p.html(q);r.attr(&quot;value&quot;,s);return false});for(k=0;k&lt;l.length;++k){if(&quot;%&quot;==l.charAt(k)){n++}}slug_value=(n&gt;l.length/4)?&quot;&quot;:l;m.html('&lt;input type=&quot;text&quot; id=&quot;new-post-slug&quot; value=&quot;'+slug_value+'&quot; /&gt;').children(&quot;input&quot;).keypress(function(u){var t=u.keyCode||0;if(13==t){p.children(&quot;.save&quot;).click();return false}if(27==t){p.children(&quot;.cancel&quot;).click();return false}r.attr(&quot;value&quot;,this.value)}).focus()};makeSlugeditClickable=function(){f(&quot;#editable-post-name&quot;).click(function(){f(&quot;#edit-slug-buttons&quot;).children(&quot;.edit-slug&quot;).click()})};makeSlugeditClickable()}});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmenuheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu-header.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu-header.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/menu-header.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">                 if ( !empty($submenu[$item[2]]) )
</span><span class="cx">                         $class[] = 'wp-has-submenu';
</span><span class="cx"> 
</span><del>-                if ( ( $parent_file &amp;&amp; $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) {
</del><ins>+                if ( ( $parent_file &amp;&amp; $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') &amp;&amp; strcmp($self, $item[2]) == 0 ) ) {
</ins><span class="cx">                         if ( !empty($submenu[$item[2]]) )
</span><span class="cx">                                 $class[] = 'wp-has-current-submenu wp-menu-open';
</span><span class="cx">                         else
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/menu.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -65,6 +65,25 @@
</span><span class="cx"> 
</span><span class="cx"> $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
</span><span class="cx"> 
</span><ins>+foreach ( (array) get_post_types( array('_show' =&gt; true) ) as $ptype ) {
+        $_wp_last_object_menu++;
+        $ptype_obj = get_post_type_object($ptype);
+        $menu[$_wp_last_object_menu] = array(esc_attr($ptype_obj-&gt;label), 'edit_' . $ptype_obj-&gt;capability_type . 's', &quot;edit.php?post_type=$ptype&quot;, '', 'menu-top', 'menu-posts', 'div');
+        $submenu[&quot;edit.php?post_type=$ptype&quot;][5]  = array( __('Edit'), 'edit_posts',  &quot;edit.php?post_type=$ptype&quot;);
+        /* translators: add new custom post type */
+        $submenu[&quot;edit.php?post_type=$ptype&quot;][10]  = array( _x('Add New', 'post'), 'edit_posts', &quot;post-new.php?post_type=$ptype&quot; );
+
+        $i = 15;
+        foreach ( $wp_taxonomies as $tax ) {
+                if ( $tax-&gt;hierarchical || ! in_array($ptype, (array) $tax-&gt;object_type, true) )
+                        continue;
+
+                $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;edit-tags.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
+                ++$i;
+        }
+}
+unset($ptype, $ptype_obj);
+
</ins><span class="cx"> $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
</span><span class="cx"> 
</span><span class="cx"> $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
</span></span></pre></div>
<a id="trunkwpadminpostnewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post-new.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post-new.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/post-new.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -8,8 +8,24 @@
</span><span class="cx"> 
</span><span class="cx"> /** Load WordPress Administration Bootstrap */
</span><span class="cx"> require_once('admin.php');
</span><del>-$title = __('Add New Post');
-$parent_file = 'edit.php';
</del><ins>+
+if ( isset($_GET['post_type']) &amp;&amp; in_array( $_GET['post_type'], get_post_types( array('_show' =&gt; true) ) ) )
+        $post_type = $_GET['post_type'];
+else
+        $post_type = 'post';
+
+if ( 'post' != $post_type ) {
+        $parent_file = &quot;edit.php?post_type=$post_type&quot;;
+        $submenu_file = &quot;post-new.php?post_type=$post_type&quot;;
+} 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-&gt;label);
+
</ins><span class="cx"> $editing = true;
</span><span class="cx"> wp_enqueue_script('autosave');
</span><span class="cx"> wp_enqueue_script('post');
</span><span class="lines">@@ -34,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx"> // Show post form.
</span><span class="cx"> $post = get_default_post_to_edit();
</span><ins>+$post-&gt;post_type = $post_type;
</ins><span class="cx"> include('edit-form-advanced.php');
</span><span class="cx"> 
</span><span class="cx"> include('admin-footer.php');
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-admin/post.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx">         }
</span><span class="cx">         $post_ID = $p = (int) $_GET['post'];
</span><span class="cx">         $post = get_post($post_ID);
</span><ins>+        $post_type_object = get_post_type_object($post-&gt;post_type);
</ins><span class="cx"> 
</span><span class="cx">         if ( empty($post-&gt;ID) )
</span><span class="cx">                 wp_die( __('You attempted to edit a post that doesn&amp;#8217;t exist. Perhaps it was deleted?') );
</span><span class="lines">@@ -136,11 +137,20 @@
</span><span class="cx">         if ( 'trash' == $post-&gt;post_status )
</span><span class="cx">                 wp_die( __('You can&amp;#8217;t edit this post because it is in the Trash. Please restore it and try again.') );
</span><span class="cx"> 
</span><del>-        if ( 'post' != $post-&gt;post_type ) {
</del><ins>+        if ( null == $post_type_object )
+                wp_die( __('Unknown post type.') );
+
+        if ( 'post' != $post-&gt;post_type &amp;&amp; $post_type_object-&gt;_builtin ) {
</ins><span class="cx">                 wp_redirect( get_edit_post_link( $post-&gt;ID, 'url' ) );
</span><span class="cx">                 exit();
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        $post_type = $post-&gt;post_type;
+        if ( 'post' != $post_type ) {
+                $parent_file = &quot;edit.php?post_type=$post_type&quot;;
+                $submenu_file = &quot;edit.php?post_type=$post_type&quot;;
+        }
+
</ins><span class="cx">         wp_enqueue_script('post');
</span><span class="cx">         if ( user_can_richedit() )
</span><span class="cx">                 wp_enqueue_script('editor');
</span><span class="lines">@@ -157,7 +167,7 @@
</span><span class="cx">                 wp_enqueue_script('autosave');
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $title = __('Edit Post');
</del><ins>+        $title = sprintf(__('Edit %s'), $post_type_object-&gt;label);
</ins><span class="cx">         $post = get_post_to_edit($post_ID);
</span><span class="cx"> 
</span><span class="cx">         include('edit-form-advanced.php');
</span></span></pre></div>
<a id="trunkwpincludescapabilitiesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/capabilities.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/capabilities.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-includes/capabilities.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -779,8 +779,9 @@
</span><span class="cx">                 $author_data = get_userdata( $user_id );
</span><span class="cx">                 //echo &quot;post ID: {$args[0]}&lt;br /&gt;&quot;;
</span><span class="cx">                 $post = get_post( $args[0] );
</span><del>-                if ( 'page' == $post-&gt;post_type ) {
-                        $args = array_merge( array( 'delete_page', $user_id ), $args );
</del><ins>+                $post_type = get_post_type_object( $post-&gt;post_type );
+                if ( $post_type &amp;&amp; 'post' != $post_type-&gt;capability_type ) {
+                        $args = array_merge( array( 'delete_' . $post_type-&gt;capability_type, $user_id ), $args );
</ins><span class="cx">                         return call_user_func_array( 'map_meta_cap', $args );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -855,8 +856,9 @@
</span><span class="cx">                 $author_data = get_userdata( $user_id );
</span><span class="cx">                 //echo &quot;post ID: {$args[0]}&lt;br /&gt;&quot;;
</span><span class="cx">                 $post = get_post( $args[0] );
</span><del>-                if ( 'page' == $post-&gt;post_type ) {
-                        $args = array_merge( array( 'edit_page', $user_id ), $args );
</del><ins>+                $post_type = get_post_type_object( $post-&gt;post_type );
+                if ( $post_type &amp;&amp; 'post' != $post_type-&gt;capability_type ) {
+                        $args = array_merge( array( 'edit_' . $post_type-&gt;capability_type, $user_id ), $args );
</ins><span class="cx">                         return call_user_func_array( 'map_meta_cap', $args );
</span><span class="cx">                 }
</span><span class="cx">                 $post_author_data = get_userdata( $post-&gt;post_author );
</span><span class="lines">@@ -913,8 +915,9 @@
</span><span class="cx">                 break;
</span><span class="cx">         case 'read_post':
</span><span class="cx">                 $post = get_post( $args[0] );
</span><del>-                if ( 'page' == $post-&gt;post_type ) {
-                        $args = array_merge( array( 'read_page', $user_id ), $args );
</del><ins>+                $post_type = get_post_type_object( $post-&gt;post_type );
+                if ( $post_type &amp;&amp; 'post' != $post_type-&gt;capability_type ) {
+                        $args = array_merge( array( 'read_' . $post_type-&gt;capability_type, $user_id ), $args );
</ins><span class="cx">                         return call_user_func_array( 'map_meta_cap', $args );
</span><span class="cx">                 }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludeslinktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/link-template.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/link-template.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-includes/link-template.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -678,39 +678,18 @@
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="cx">         if ( 'display' == $context )
</span><del>-                $action = 'action=edit&amp;amp;';
</del><ins>+                $action = '&amp;amp;action=edit';
</ins><span class="cx">         else
</span><del>-                $action = 'action=edit&amp;';
</del><ins>+                $action = '&amp;action=edit';
</ins><span class="cx"> 
</span><del>-        switch ( $post-&gt;post_type ) :
-        case 'page' :
-                if ( !current_user_can( 'edit_page', $post-&gt;ID ) )
-                        return;
-                $file = 'page';
-                $var  = 'post';
-                break;
-        case 'attachment' :
-                if ( !current_user_can( 'edit_post', $post-&gt;ID ) )
-                        return;
-                $file = 'media';
-                $var  = 'attachment_id';
-                break;
-        case 'revision' :
-                if ( !current_user_can( 'edit_post', $post-&gt;ID ) )
-                        return;
-                $file = 'revision';
-                $var  = 'revision';
-                $action = '';
-                break;
-        default :
-                if ( !current_user_can( 'edit_post', $post-&gt;ID ) )
-                        return apply_filters( 'get_edit_post_link', '', $post-&gt;ID, $context );
-                $file = 'post';
-                $var  = 'post';
-                break;
-        endswitch;
</del><ins>+        $post_type_object = get_post_type_object( $post-&gt;post_type ); 
+        if ( !$post_type_object )
+                return;
</ins><span class="cx"> 
</span><del>-        return apply_filters( 'get_edit_post_link', admin_url(&quot;$file.php?{$action}$var=$post-&gt;ID&quot;), $post-&gt;ID, $context );
</del><ins>+        if ( !current_user_can( $post_type_object-&gt;edit_cap, $post-&gt;ID ) )
+                return;
+
+        return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object-&gt;_edit_link . $action, $post-&gt;ID) ), $post-&gt;ID, $context );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-includes/post.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -15,10 +15,10 @@
</span><span class="cx">  * Creates the initial post types when 'init' action is fired.
</span><span class="cx">  */
</span><span class="cx"> function create_initial_post_types() {
</span><del>-        register_post_type( 'post', array('exclude_from_search' =&gt; false) );
-        register_post_type( 'page', array('exclude_from_search' =&gt; false) );
-        register_post_type( 'attachment', array('exclude_from_search' =&gt; false) );
-        register_post_type( 'revision', array('exclude_from_search' =&gt; true) );
</del><ins>+        register_post_type( 'post', array('label' =&gt; __('Posts'), 'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'post.php?post=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
+        register_post_type( 'page', array('label' =&gt; __('Pages'),'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'page.php?post=%d', 'capability_type' =&gt; 'page', 'hierarchical' =&gt; true) );
+        register_post_type( 'attachment', array('label' =&gt; __('Media'), 'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'media.php?attachment_id=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
+        register_post_type( 'revision', array('label' =&gt; __('Revisions'),'exclude_from_search' =&gt; true, '_builtin' =&gt; true, '_edit_link' =&gt; 'revision.php?revision=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
</span><span class="cx"> 
</span><span class="lines">@@ -442,6 +442,28 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Retrieve a post type object by name
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 3.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];
+}
+
+/**
</ins><span class="cx">  * Get a list of all registered post type objects.
</span><span class="cx">  *
</span><span class="cx">  * @package WordPress
</span><span class="lines">@@ -491,7 +513,12 @@
</span><span class="cx">  *
</span><span class="cx">  * Optional $args contents:
</span><span class="cx">  *
</span><ins>+ * label - A descriptive 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.
</ins><span class="cx">  * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true.
</span><ins>+ * 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 &quot;post&quot;.
+ * hierarchical - Whether the post type is hierarchical. Defaults to false.
</ins><span class="cx">  *
</span><span class="cx">  * @package WordPress
</span><span class="cx">  * @subpackage Post
</span><span class="lines">@@ -507,12 +534,31 @@
</span><span class="cx">         if (!is_array($wp_post_types))
</span><span class="cx">                 $wp_post_types = array();
</span><span class="cx"> 
</span><del>-        $defaults = array('exclude_from_search' =&gt; true);
</del><ins>+        // Args prefixed with an underscore are reserved for internal use.
+        $defaults = array('label' =&gt; false, 'exclude_from_search' =&gt; true, '_builtin' =&gt; false, '_edit_link' =&gt; 'post.php?post=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false, 'public' =&gt; false, '_show' =&gt; false);
</ins><span class="cx">         $args = wp_parse_args($args, $defaults);
</span><ins>+        $args = (object) $args;
</ins><span class="cx"> 
</span><span class="cx">         $post_type = sanitize_user($post_type, true);
</span><del>-        $args['name'] = $post_type;
-        $wp_post_types[$post_type] = (object) $args;
</del><ins>+        $args-&gt;name = $post_type;
+
+        if ( false === $args-&gt;label )
+                $args-&gt;label = $post_type;
+
+        if ( empty($args-&gt;capability_type) ) {
+                $args-&gt;edit_cap = '';
+                $args-&gt;read_cap = '';
+        } else {
+                $args-&gt;edit_cap = 'edit_' . $args-&gt;capability_type;
+                $args-&gt;read_cap = 'read_' . $args-&gt;capability_type;
+        }
+
+        if ( !$args-&gt;_builtin &amp;&amp; $args-&gt;public )
+                $args-&gt;_show = true;
+
+        $wp_post_types[$post_type] = $args;
+
+        return $args;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1018,7 +1064,8 @@
</span><span class="cx"> 
</span><span class="cx">         $query = &quot;SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb-&gt;posts} WHERE post_type = %s&quot;;
</span><span class="cx">         if ( 'readable' == $perm &amp;&amp; is_user_logged_in() ) {
</span><del>-                if ( !current_user_can(&quot;read_private_{$type}s&quot;) ) {
</del><ins>+                $post_type_object = get_post_type_object($type);
+                if ( !current_user_can(&quot;read_private_{$post_type_object-&gt;capability_type}s&quot;) ) {
</ins><span class="cx">                         $cache_key .= '_' . $perm . '_' . $user-&gt;ID;
</span><span class="cx">                         $query .= &quot; AND (post_status != 'private' OR ( post_author = '$user-&gt;ID' AND post_status = 'private' ))&quot;;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkwpincludesqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/query.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/query.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-includes/query.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -2062,8 +2062,13 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( is_array($post_type) )
</span><span class="cx">                         $post_type_cap = 'multiple_post_type';
</span><del>-                else
-                        $post_type_cap = $post_type;
</del><ins>+                else {
+                        $post_type_object = get_post_type_object ( $post_type );
+                        if ( !empty($post_type_object) )
+                                $post_type_cap = $post_type_object-&gt;capability_type; 
+                        else
+                                $post_type_cap = $post_type;
+                }
</ins><span class="cx"> 
</span><span class="cx">                 $exclude_post_types = '';
</span><span class="cx">                 foreach ( get_post_types( array('exclude_from_search' =&gt; true) ) as $_wp_post_type )
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (12596 => 12597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-01-02 17:16:26 UTC (rev 12596)
+++ trunk/wp-includes/taxonomy.php        2010-01-04 16:58:43 UTC (rev 12597)
</span><span class="lines">@@ -180,20 +180,46 @@
</span><span class="cx">                 $wp-&gt;add_query_var($args['query_var']);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( false !== $args['rewrite'] &amp;&amp; !empty($wp_rewrite) ) {
</del><ins>+        if ( false !== $args['rewrite'] &amp;&amp; '' != get_option('permalink_structure') ) {
</ins><span class="cx">                 if ( !is_array($args['rewrite']) )
</span><span class="cx">                         $args['rewrite'] = array();
</span><span class="cx">                 if ( !isset($args['rewrite']['slug']) )
</span><span class="cx">                         $args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
</span><span class="cx">                 $wp_rewrite-&gt;add_rewrite_tag(&quot;%$taxonomy%&quot;, '([^/]+)', $args['query_var'] ? &quot;{$args['query_var']}=&quot; : &quot;taxonomy=$taxonomy&amp;term=$term&quot;);
</span><del>-                $wp_rewrite-&gt;add_permastruct($taxonomy, &quot;{$args['rewrite']['slug']}/%$taxonomy%&quot;);
</del><ins>+                $wp_rewrite-&gt;add_permastruct($taxonomy, &quot;/{$args['rewrite']['slug']}/%$taxonomy%&quot;);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $args['name'] = $taxonomy;
</span><del>-        $args['object_type'] = $object_type;
</del><ins>+        $args['object_type'] = (array) $object_type;
</ins><span class="cx">         $wp_taxonomies[$taxonomy] = (object) $args;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Add an already registered taxonomy to an object type.
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 3.0
+ * @uses $wp_taxonomies Modifies taxonomy object
+ *
+ * @param string $taxonomy Name of taxonomy object
+ * @param array|string $object_type Name of the object type
+ * @return bool True if successful, false if not
+ */
+function register_taxonomy_for_object_type( $taxonomy, $object_type) {
+        global $wp_taxonomies;
+
+        if ( !isset($wp_taxonomies[$taxonomy]) )
+                return false;
+
+        if ( ! get_post_type_object($object_type) )
+                return false;
+
+        $wp_taxonomies[$taxonomy]-&gt;object_type[] = $object_type;
+
+        return true;
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Term API
</span><span class="cx"> //
</span><span class="lines">@@ -2378,4 +2404,26 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Determine if the given object type is associated with the given taxonomy.
+ *
+ * @since 3.0
+ * @uses get_object_taxonomies()
+ *
+ * @param string $object_type Object type string
+ * @param string $taxonomy.  Single taxonomy name
+ * @return bool True if object is associated with the taxonomy, otherwise false.
+ */
+function is_object_in_taxonomy($object_type, $taxonomy) {
+        $taxonomies = get_object_taxonomies($object_type);
+
+        if ( empty($taxonomies) )
+                return false;
+
+        if ( in_array($taxonomy, $taxonomies) )
+                return true;
+
+        return false;
+}
+
</ins><span class="cx"> ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>