<!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>[13101] trunk: Introduce 'singular_label' for Post Types.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13101">13101</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-02-13 08:56:38 +0000 (Sat, 13 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Introduce 'singular_label' for Post Types. Props scribu. See <a href="http://trac.wordpress.org/ticket/12214">#12214</a></pre>
<h3>Modified Paths</h3>
<ul>
<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="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminpostnewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post-new.php (13100 => 13101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post-new.php        2010-02-13 08:49:27 UTC (rev 13100)
+++ trunk/wp-admin/post-new.php        2010-02-13 08:56:38 UTC (rev 13101)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">
</span><span class="cx"> $post_type_object = get_post_type_object($post_type);
</span><span class="cx">
</span><del>-$title = sprintf(__('Add New %s'), $post_type_object->label);
</del><ins>+$title = sprintf(__('Add New %s'), $post_type_object->singular_label);
</ins><span class="cx">
</span><span class="cx"> $editing = true;
</span><span class="cx"> wp_enqueue_script('autosave');
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (13100 => 13101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2010-02-13 08:49:27 UTC (rev 13100)
+++ trunk/wp-admin/post.php        2010-02-13 08:56:38 UTC (rev 13101)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">                 wp_enqueue_script('autosave');
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $title = sprintf(__('Edit %s'), $post_type_object->label);
</del><ins>+        $title = sprintf(__('Edit %s'), $post_type_object->singular_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="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (13100 => 13101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-02-13 08:49:27 UTC (rev 13100)
+++ trunk/wp-includes/post.php        2010-02-13 08:56:38 UTC (rev 13101)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> */
</span><span class="cx"> function create_initial_post_types() {
</span><span class="cx">         register_post_type( 'post', array(        'label' => __('Posts'),
</span><ins>+                                                                                'singular_label' => __('Post'),
</ins><span class="cx">                                                                                 'public' => true,
</span><span class="cx">                                                                                 'show_ui' => false,
</span><span class="cx">                                                                                 '_builtin' => true,
</span><span class="lines">@@ -28,6 +29,7 @@
</span><span class="cx">                                                                         ) );
</span><span class="cx">
</span><span class="cx">         register_post_type( 'page', array(        'label' => __('Pages'),
</span><ins>+                                                                                'singular_label' => __('Page'),
</ins><span class="cx">                                                                                 'public' => true,
</span><span class="cx">                                                                                 'show_ui' => false,
</span><span class="cx">                                                                                 '_builtin' => true,
</span><span class="lines">@@ -51,6 +53,7 @@
</span><span class="cx">                                                                                 ) );
</span><span class="cx">
</span><span class="cx">         register_post_type( 'revision', array(        'label' => __('Revisions'),
</span><ins>+                                                                                        'singular_label' => __('Revision'),
</ins><span class="cx">                                                                                         'public' => false,
</span><span class="cx">                                                                                         '_builtin' => true,
</span><span class="cx">                                                                                         '_edit_link' => 'revision.php?revision=%d',
</span><span class="lines">@@ -712,7 +715,8 @@
</span><span class="cx"> *
</span><span class="cx"> * Optional $args contents:
</span><span class="cx"> *
</span><del>- * label - A descriptive name for the post type marked for translation. Defaults to $post_type.
</del><ins>+ * label - A (plural) descriptive name for the post type marked for translation. Defaults to $post_type.
+ * singular_label - A (singular) descriptive name for the post type marked for translation. Defaults to $label.
</ins><span class="cx"> * description - A short descriptive summary of what the post type is. Defaults to blank.
</span><span class="cx"> * public - Whether posts of this type should be shown in the admin UI. Defaults to false.
</span><span class="cx"> * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public.
</span><span class="lines">@@ -746,7 +750,7 @@
</span><span class="cx">                 $wp_post_types = array();
</span><span class="cx">
</span><span class="cx">         // Args prefixed with an underscore are reserved for internal use.
</span><del>-        $defaults = array('label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null );
</del><ins>+        $defaults = array('label' => false, 'singular_label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null );
</ins><span class="cx">         $args = wp_parse_args($args, $defaults);
</span><span class="cx">         $args = (object) $args;
</span><span class="cx">
</span><span class="lines">@@ -768,6 +772,9 @@
</span><span class="cx">         if ( false === $args->label )
</span><span class="cx">                 $args->label = $post_type;
</span><span class="cx">
</span><ins>+        if ( false === $args->singular_label )
+                $args->singular_label = $args->label;
+
</ins><span class="cx">         if ( empty($args->capability_type) )
</span><span class="cx">                 $args->capability_type = 'post';
</span><span class="cx">         if ( empty($args->edit_cap) )
</span><span class="lines">@@ -4403,4 +4410,4 @@
</span><span class="cx">
</span><span class="cx">                 add_filter('the_preview', '_set_preview');
</span><span class="cx">         }
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>