Make WordPress Core

Ticket #40188: 40188.2.diff

File 40188.2.diff, 1.9 KB (added by dinhtungdu, 8 years ago)

Hide entry table nav when there is no item

  • src/wp-admin/includes/class-wp-comments-list-table.php

     
    345345                                        'pings' => __( 'Pings' ),
    346346                                ) );
    347347
    348                                 foreach ( $comment_types as $type => $label )
    349                                         echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n";
     348                                foreach ( $comment_types as $type => $label ) {
     349                                        if( get_comments(array('number' => 1, 'type' => $type))) {
     350                                                echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n";
     351                                        }
     352                                }
    350353                        ?>
    351354                        </select>
    352355<?php
  • src/wp-admin/includes/class-wp-list-table.php

     
    11721172         * @param string $which
    11731173         */
    11741174        protected function display_tablenav( $which ) {
     1175
    11751176                if ( 'top' === $which ) {
    11761177                        wp_nonce_field( 'bulk-' . $this->_args['plural'] );
    11771178                }
    1178                 ?>
    1179         <div class="tablenav <?php echo esc_attr( $which ); ?>">
     1179                if ( $this->has_items() ): ?>
     1180                        <div class="tablenav <?php echo esc_attr( $which ); ?>">
    11801181
    1181                 <?php if ( $this->has_items() ): ?>
    1182                 <div class="alignleft actions bulkactions">
    1183                         <?php $this->bulk_actions( $which ); ?>
    1184                 </div>
    1185                 <?php endif;
    1186                 $this->extra_tablenav( $which );
    1187                 $this->pagination( $which );
    1188 ?>
     1182                                <div class="alignleft actions bulkactions">
     1183                                        <?php $this->bulk_actions( $which ); ?>
     1184                                </div>
     1185                                <?php $this->extra_tablenav( $which );
     1186                                $this->pagination( $which );
     1187                                ?>
    11891188
    1190                 <br class="clear" />
    1191         </div>
    1192 <?php
     1189                                <br class="clear"/>
     1190                        </div>
     1191                        <?php
     1192                endif;
    11931193        }
    11941194
    11951195        /**