[wp-trac] [WordPress Trac] #49962: Remove hardcoded strong definition from title (admin) column

WordPress Trac noreply at wordpress.org
Mon Apr 20 17:57:34 UTC 2020


#49962: Remove hardcoded strong definition from title (admin) column
---------------------------------+-----------------------------
 Reporter:  Beee                 |      Owner:  (none)
     Type:  enhancement          |     Status:  new
 Priority:  normal               |  Milestone:  Awaiting Review
Component:  Administration       |    Version:
 Severity:  normal               |   Keywords:  2nd-opinion
  Focuses:  css, administration  |
---------------------------------+-----------------------------
 **Reason for ticket**
 In wp-admin/includes/class-wp-posts-list-table.php on line 1013 and 1039
 there are 2 hardcoded strong definitions.

 **What happened?**
 When I decided to change the default column with the filter
 [https://developer.wordpress.org/reference/hooks/list_table_primary_column/
 list_table_primary_column], I noticed the title was still bolded, which I
 didn't want.

 -=-

 When I looked at the source code I saw a hardcoded definition, hence why I
 made a dynamic suggestion to fix this.

 - remove strong on line 1013
 - remove /strong on line 1039
 - add on line 1018

 {{{
 $column       = apply_filters( 'list_table_primary_column',
 WP_List_Table::get_default_primary_column_name(), $this->screen->id );
 $bolded_class = ( 'title' === $column ) ? 'bolded-class' : false;
 }}}

 - change printf statement to
 {{{
 printf(
         '<a class="row-title%s" href="%s" aria-label="%s">%s%s</a>',
          $bolded_class,
         get_edit_post_link( $post->ID ),
         /* translators: %s: Post title. */
         esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ),
         $pad,
         $title
 );
 }}}

 - add after `$label`, originally on line 1201
 {{{
 $default_column = WP_List_Table::get_default_primary_column_name();
 $bolded_class   = ( $column_name === $default_column ) ? 'bolded-class' :
 false;
 }}}

 - change `$term_links`, originally on line 1203
 {{{
 $term_links[]   = $this->get_edit_link( $posts_in_term_qv, $label );
 }}}
 - To
 {{{
 $term_links[]   = $this->get_edit_link( $posts_in_term_qv, $label,
 $bolded_class );
 }}}

 - add to css (don’t know which file)
 {{{
 .bolded-class {
     font-weight: strong;
 }
 }}}

 Any feedback is welcome.

 Something similar is happening on
 * line 420 in class-wp-terms-list-table.php
 * line 192 in class-wp-links-list-table.php
 but I didn't look into that yet.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49962>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list