Ticket #37782: 37782.2.diff
File 37782.2.diff, 4.6 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/class-walker-nav-menu-checklist.php
94 94 } elseif ( isset( $item->post_type ) ) { 95 95 /** This filter is documented in wp-includes/post-template.php */ 96 96 $title = apply_filters( 'the_title', $item->post_title, $item->ID ); 97 if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) { 98 /* translators: %s: front page title */ 99 $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); 97 98 /** Append post states */ 99 $post_states = get_post_states( $post ); 100 101 if ( ! empty( $post_states ) ) { 102 $state_count = count( $post_states ); 103 $i = 0; 104 $title .= ' — '; 105 foreach ( $post_states as $state ) { 106 ++$i; 107 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 108 $title .= "<span class='post-state'>$state$sep</span>"; 109 } 100 110 } 101 111 } 102 112 -
src/wp-admin/includes/nav-menu.php
521 521 $args['walker'] = $walker; 522 522 523 523 /* 524 * If we're dealing with pages, let's put a checkbox for the front525 * page at the top of the list.524 * If we're dealing with pages, let's put a checkbox(es) for the front 525 * page, posts page and privacy page at the top of the list. 526 526 */ 527 527 if ( 'page' == $post_type_name ) { 528 528 $front_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0; 529 $posts_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0; 530 $privacy_page = (int) get_option( 'wp_page_for_privacy_policy' ); 531 532 /* 533 * Supress important pages from $posts prior to re-inserting them at the top 534 * This avoids the duplicate entry in the list. 535 */ 536 if ( ! ( empty( $front_page ) && empty( $posts_page ) && empty( $privacy_page ) ) ) { 537 foreach ( $posts as $key => $post ) { 538 if ( $post->ID == $front_page || $post->ID == $posts_page || $post->ID == $privacy_page ) { 539 unset( $posts[$key] ); 540 } 541 } 542 } 543 544 /* 545 * Insert Privacy Page. 546 */ 547 if ( ! empty( $privacy_page ) ) { 548 $privacy_page_obj = get_post( $privacy_page ); 549 $privacy_page_obj->privacy_page = true; 550 array_unshift( $posts, $privacy_page_obj ); 551 } 552 553 /* 554 * Insert Posts Page. 555 */ 556 if ( ! empty( $posts_page ) ) { 557 $posts_page_obj = get_post( $posts_page ); 558 $front_page_obj->posts_page = true; 559 array_unshift( $posts, $posts_page_obj ); 560 } 561 562 /* 563 * Insert Front Page or custom home link. 564 */ 529 565 if ( ! empty( $front_page ) ) { 530 566 $front_page_obj = get_post( $front_page ); 531 567 $front_page_obj->front_or_home = true; -
src/wp-admin/includes/template.php
1872 1872 * @param WP_Post $post 1873 1873 */ 1874 1874 function _post_states( $post ) { 1875 $post_states = get_post_states( $post ); 1876 1877 if ( ! empty( $post_states ) ) { 1878 $state_count = count( $post_states ); 1879 $i = 0; 1880 echo ' — '; 1881 foreach ( $post_states as $state ) { 1882 ++$i; 1883 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 1884 echo "<span class='post-state'>$state$sep</span>"; 1885 } 1886 } 1887 } 1888 1889 /** 1890 * @param WP_Post $post 1891 * 1892 * @return array $post_states array of translated post states 1893 * 1894 * @since X.X.X 1895 */ 1896 function get_post_states( $post ) { 1875 1897 $post_states = array(); 1876 1898 if ( isset( $_REQUEST['post_status'] ) ) { 1877 1899 $post_status = $_REQUEST['post_status']; … … 1928 1950 * @param string[] $post_states An array of post display states. 1929 1951 * @param WP_Post $post The current post object. 1930 1952 */ 1931 $post_states = apply_filters( 'display_post_states', $post_states, $post ); 1932 1933 if ( ! empty( $post_states ) ) { 1934 $state_count = count( $post_states ); 1935 $i = 0; 1936 echo ' — '; 1937 foreach ( $post_states as $state ) { 1938 ++$i; 1939 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 1940 echo "<span class='post-state'>$state$sep</span>"; 1941 } 1942 } 1943 1953 return apply_filters( 'display_post_states', $post_states, $post ); 1944 1954 } 1945 1955 1946 1956 /**