Make WordPress Core

Ticket #40188: 40188.3.patch

File 40188.3.patch, 1.1 KB (added by Jim_Panse, 8 years ago)
  • src/wp-admin/includes/class-wp-comments-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php
    index fa41a72..62a9a52 100644
    a b class WP_Comments_List_Table extends WP_List_Table { 
    322322?>
    323323                <div class="alignleft actions">
    324324<?php
    325                 if ( 'top' === $which ) {
     325                if ( 'top' === $which && $this->has_comments() ) {
    326326?>
    327327                        <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label>
    328328                        <select id="filter-by-comment-type" name="comment_type">
    class WP_Comments_List_Table extends WP_List_Table { 
    790790                 */
    791791                do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
    792792        }
     793
     794        /**
     795         * Tells if there is minimum one comment not in trash
     796         */
     797        protected function has_comments() {
     798                $comments = get_comments( array(
     799                        'number' => 1,
     800                        ) );
     801                if( $comments ) {
     802                        return true;
     803                } else {
     804                        return false;
     805                }
     806        }
    793807}