<!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" />
<title>[46309] trunk/src/wp-admin: Menus: Duplicate Page Entry in View All Pages when generating a Menu</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/46309">46309</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/46309","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>whyisjake</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-09-25 21:51:00 +0000 (Wed, 25 Sep 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Menus: Duplicate Page Entry in View All Pages when generating a Menu
Simplifies the interface in menu creation.
Fixes <a href="https://core.trac.wordpress.org/changeset/37782">[37782]</a>
Props garrett-eclipse, mdgl, birgire, xkon, audrasjb, pento, girlieworks</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssnavmenuscss">trunk/src/wp-admin/css/nav-menus.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswalkernavmenuchecklistphp">trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php</a></li>
<li><a href="#trunksrcwpadminincludesnavmenuphp">trunk/src/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunksrcwpadminincludestemplatephp">trunk/src/wp-admin/includes/template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincssnavmenuscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/nav-menus.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/nav-menus.css 2019-09-25 21:37:09 UTC (rev 46308)
+++ trunk/src/wp-admin/css/nav-menus.css 2019-09-25 21:51:00 UTC (rev 46309)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -413,6 +413,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin-top: -4px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.menu-item-title .post-state {
+ font-weight: 600;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* Nav Menu */
</span><span class="cx" style="display: block; padding: 0 10px"> #menu-container .inside {
</span><span class="cx" style="display: block; padding: 0 10px"> padding-bottom: 10px;
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswalkernavmenuchecklistphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php 2019-09-25 21:37:09 UTC (rev 46308)
+++ trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php 2019-09-25 21:51:00 UTC (rev 46309)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,13 +94,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $item->post_type ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in wp-includes/post-template.php */
</span><span class="cx" style="display: block; padding: 0 10px"> $title = apply_filters( 'the_title', $item->post_title, $item->ID );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) {
- /* translators: %s: Front page title. */
- $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title );
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( empty( $item->label ) && isset( $item->post_type ) && 'page' === $item->post_type ) {
+ // Append post states.
+ $output .= _post_states( $item, false );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $output .= '</label>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Menu item hidden fields
</span></span></pre></div>
<a id="trunksrcwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/nav-menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/nav-menu.php 2019-09-25 21:37:09 UTC (rev 46308)
+++ trunk/src/wp-admin/includes/nav-menu.php 2019-09-25 21:51:00 UTC (rev 46309)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -354,12 +354,88 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $args = array_merge( $args, (array) $box['args']->_default_query );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * If we're dealing with pages, let's prioritize the Front Page,
+ * Posts Page and Privacy Policy Page at the top of the list.
+ */
+ $important_pages = array();
+ if ( 'page' == $post_type_name ) {
+ $suppress_page_ids = array();
+
+ // Insert Front Page or custom Home link.
+ $front_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;
+
+ $front_page_obj = null;
+ if ( ! empty( $front_page ) ) {
+ $front_page_obj = get_post( $front_page );
+ $front_page_obj->front_or_home = true;
+
+ $important_pages[] = $front_page_obj;
+ $suppress_page_ids[] = $front_page_obj->ID;
+ } else {
+ $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
+ $front_page_obj = (object) array(
+ 'front_or_home' => true,
+ 'ID' => 0,
+ 'object_id' => $_nav_menu_placeholder,
+ 'post_content' => '',
+ 'post_excerpt' => '',
+ 'post_parent' => '',
+ 'post_title' => _x( 'Home', 'nav menu home label' ),
+ 'post_type' => 'nav_menu_item',
+ 'type' => 'custom',
+ 'url' => home_url( '/' ),
+ );
+
+ $important_pages[] = $front_page_obj;
+ }
+
+ // Insert Posts Page.
+ $posts_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0;
+
+ if ( ! empty( $posts_page ) ) {
+ $posts_page_obj = get_post( $posts_page );
+ $posts_page_obj->posts_page = true;
+
+ $important_pages[] = $posts_page_obj;
+ $suppress_page_ids[] = $posts_page_obj->ID;
+ }
+
+ // Insert Privacy Policy Page.
+ $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
+
+ if ( ! empty( $privacy_policy_page_id ) ) {
+ $privacy_policy_page = get_post( $privacy_policy_page_id );
+ if ( $privacy_policy_page instanceof WP_Post && 'publish' === $privacy_policy_page->post_status ) {
+ $privacy_policy_page->privacy_policy_page = true;
+
+ $important_pages[] = $privacy_policy_page;
+ $suppress_page_ids[] = $privacy_policy_page->ID;
+ }
+ }
+
+ // Add suppression array to arguments for WP_Query.
+ if ( ! empty( $suppress_page_ids ) ) {
+ $args['post__not_in'] = $suppress_page_ids;
+ }
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // @todo transient caching of these results with proper invalidation on updating of a post of this type
</span><span class="cx" style="display: block; padding: 0 10px"> $get_posts = new WP_Query;
</span><span class="cx" style="display: block; padding: 0 10px"> $posts = $get_posts->query( $args );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Only suppress and insert when more than just suppression pages available.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $get_posts->post_count ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<p>' . __( 'No items.' ) . '</p>';
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $suppress_page_ids ) ) {
+ unset( $args['post__not_in'] );
+ $get_posts = new WP_Query;
+ $posts = $get_posts->query( $args );
+ } else {
+ echo '<p>' . __( 'No items.' ) . '</p>';
+ return;
+ }
+ } elseif ( ! empty( $important_pages ) ) {
+ $posts = array_merge( $important_pages, $posts );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $num_pages = $get_posts->max_num_pages;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -522,36 +598,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> $args['walker'] = $walker;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*
- * If we're dealing with pages, let's put a checkbox for the front
- * page at the top of the list.
- */
- if ( 'page' == $post_type_name ) {
- $front_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;
- if ( ! empty( $front_page ) ) {
- $front_page_obj = get_post( $front_page );
- $front_page_obj->front_or_home = true;
- array_unshift( $posts, $front_page_obj );
- } else {
- $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
- array_unshift(
- $posts,
- (object) array(
- 'front_or_home' => true,
- 'ID' => 0,
- 'object_id' => $_nav_menu_placeholder,
- 'post_content' => '',
- 'post_excerpt' => '',
- 'post_parent' => '',
- 'post_title' => _x( 'Home', 'nav menu home label' ),
- 'post_type' => 'nav_menu_item',
- 'type' => 'custom',
- 'url' => home_url( '/' ),
- )
- );
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $post_type = get_post_type_object( $post_type_name );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $post_type->has_archive ) {
</span></span></pre></div>
<a id="trunksrcwpadminincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/template.php 2019-09-25 21:37:09 UTC (rev 46308)
+++ trunk/src/wp-admin/includes/template.php 2019-09-25 21:51:00 UTC (rev 46309)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2062,9 +2062,50 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Function to echo or return the Post States as HTML.
+ *
+ * @since 2.7.0
+ * @since 5.3.0 Adopted use of get_post_states
+ *
+ * @param WP_Post $post The post to retrieve states for.
+ * @param boolean $echo Optional. Whether to echo or return the Post States as an HTML string. Default true for echo.
+ *
+ * @return string|void Post States string when echo is false.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _post_states( $post ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _post_states( $post, $echo = true ) {
+ $post_states = get_post_states( $post );
+ $post_states_string = '';
+
+ if ( ! empty( $post_states ) ) {
+ $state_count = count( $post_states );
+ $i = 0;
+
+ $post_states_string .= ' — ';
+ foreach ( $post_states as $state ) {
+ ++$i;
+ ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+ $post_states_string .= "<span class='post-state'>$state$sep</span>";
+ }
+ }
+
+ if ( $echo ) {
+ echo $post_states_string;
+ }
+
+ return $post_states_string;
+}
+
+/**
+ * Function to retrieve an array of Post States from a Post.
+ *
+ * @since 5.3.0
+ *
+ * @param WP_Post $post The post to retrieve states for.
+ *
+ * @return array $post_states The array of translated post states.
+ *
+ */
+function get_post_states( $post ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_states = array();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_REQUEST['post_status'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_status = $_REQUEST['post_status'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2073,43 +2114,47 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $post->post_password ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['protected'] = __( 'Password protected' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['protected'] = _x( 'Password protected', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'private' == $post->post_status && 'private' != $post_status ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['private'] = __( 'Private' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['private'] = _x( 'Private', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'draft' === $post->post_status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_states[] = __( 'Customization Draft' );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( 'draft' !== $post_status ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['draft'] = __( 'Draft' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['draft'] = _x( 'Draft', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( 'trash' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states[] = __( 'Customization Draft' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states[] = _x( 'Customization Draft', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'pending' == $post->post_status && 'pending' != $post_status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_states['pending'] = _x( 'Pending', 'post status' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_sticky( $post->ID ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['sticky'] = __( 'Sticky' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['sticky'] = _x( 'Sticky', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'future' === $post->post_status ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['scheduled'] = __( 'Scheduled' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['scheduled'] = _x( 'Scheduled', 'post status' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'page' === get_option( 'show_on_front' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['page_on_front'] = __( 'Front Page' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['page_on_front'] = _x( 'Front Page', 'page label' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['page_for_posts'] = __( 'Posts Page' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states['page_for_privacy_policy'] = __( 'Privacy Policy Page' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2121,19 +2166,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $post_states An array of post display states.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Post $post The current post object.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_states = apply_filters( 'display_post_states', $post_states, $post );
-
- if ( ! empty( $post_states ) ) {
- $state_count = count( $post_states );
- $i = 0;
- echo ' — ';
- foreach ( $post_states as $state ) {
- ++$i;
- ( $i == $state_count ) ? $sep = '' : $sep = ', ';
- echo "<span class='post-state'>$state$sep</span>";
- }
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return apply_filters( 'display_post_states', $post_states, $post );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre>
</div>
</div>
</body>
</html>