Make WordPress Core

Ticket #32942: 32942.diff

File 32942.diff, 2.6 KB (added by chiragrathod103, 3 years ago)

I have create one solution but I need some design suggestion, I have added title attribute so, on hover it will display text for two different count values, but then also I need some suggestion for make more better.

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

    diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php
    index 3c277d6a61..a874a18993 100644
    a b class WP_Terms_List_Table extends WP_List_Table { 
    602602                        return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
    603603                }
    604604
     605                $query_args = array(
     606                        'post_type' => $this->screen->post_type,
     607                        'post_status' => 'publish',
     608                        'tax_query' => array(
     609                                array(
     610                                        'taxonomy' => $this->screen->taxonomy,
     611                                        'field' => 'id',
     612                                        'terms' => array( $tag->term_id ),
     613                                ),
     614                        ),
     615                );
     616                $the_query = new WP_Query( $query_args );
     617               
     618                if ( isset( $the_query->found_posts ) && $the_query->found_posts != $count ) {
     619                        return "<span title='". esc_attr( sprintf( __( 'Current %s count' ), $this->screen->post_type ) ) ."'>[ <a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$the_query->found_posts</a> ]</span> <span title='". esc_attr( 'Total count' ) ."'> [ <a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a> ]</span>";
     620                }
     621
    605622                return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
    606623        }
    607624