WordPress.org

Make WordPress Core

Ticket #19711: 19711.3.patch

File 19711.3.patch, 2.0 KB (added by chriscct7, 22 months ago)

Changes to use post type label

  • wp-admin/edit.php

     
    316316<div class="wrap">
    317317<h1><?php
    318318echo esc_html( $post_type_object->labels->name );
    319 if ( current_user_can( $post_type_object->cap->create_posts ) )
     319if ( current_user_can( $post_type_object->cap->create_posts ) ) {
    320320        echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
    321321
     322}
     323
    322324if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    323325        /* translators: %s: search keywords */
    324326        printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
    325327}
     328
     329if ( ! empty( $_REQUEST['m'] ) || ! empty( $_REQUEST['cat'] ) || !empty( $_REQUEST['author'] ) ) {
     330        $post_filters = array();
     331        if ( ! empty( $_REQUEST['cat'] )  ) {
     332                $post_filters[] = single_cat_title( '', false );
     333        }
     334       
     335        if ( ! empty( $_REQUEST['author'] ) ) {
     336                $post_filters[] = get_user_meta( $_REQUEST['author'], 'nickname', true );
     337        }
     338
     339        if ( ! empty( $_REQUEST['m'] ) ) {
     340                /* translators: 1: month name, 2: 4-digit year */
     341                $post_filters[] = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( substr( $_REQUEST['m'], 4, 2 ) ), substr( $_REQUEST['m'], 0, 4 ) );
     342        }
     343        printf( ' <span class="subtitle">' . __( 'Showing %s from: %s' ) . '</span>', $post_type_object->labels->label, implode(', ', $post_filters ) );
     344}
    326345?></h1>
    327346
    328347<?php
  • wp-admin/includes/class-wp-posts-list-table.php

     
    462462
    463463                        $this->months_dropdown( $this->screen->post_type );
    464464                        $this->categories_dropdown( $this->screen->post_type );
     465                        $this->authors_dropdown( $this->screen->post_type );
    465466
    466467                        /**
    467468                         * Fires before the Filter button on the Posts and Pages list tables.