WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/14/2015 10:13:03 PM (7 years ago)
Author:
helen
Message:

List tables: Use CSS :nth-child() selectors for zebra striping.

Note that this does not fix issues related to comment quick edit. Internal linking also continues to use the .alternate class for now. IE8 and below gracefully degrade by not having zebra striping.

There is some hoop jumping with adding an extra table row to maintain zebra striping during quick edit. Documenting that here for future reference; it is also in the inline documentation.

fixes #30981 and #26060. see #25060.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r31165 r31181  
    289289
    290290    protected function get_table_classes() {
    291         return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
     291        return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
    292292    }
    293293
     
    573573    /**
    574574     * @global string $mode
    575      * @staticvar string $alternate
    576575     * @param WP_Post $post
    577576     * @param int $level
     
    579578    public function single_row( $post, $level = 0 ) {
    580579        global $mode;
    581         static $alternate;
    582580
    583581        $global_post = get_post();
     
    590588        $can_edit_post = current_user_can( 'edit_post', $post->ID );
    591589
    592         $alternate = 'alternate' == $alternate ? '' : 'alternate';
    593         $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
     590        $classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    594591
    595592        $lock_holder = wp_check_post_lock( $post->ID );
Note: See TracChangeset for help on using the changeset viewer.