In this Example, let's assume every item had the attribute $item['approved'] with values Zero unapproved and One for approved.

How can I get the rows of the "unapproved books" to be yellow?

(well, it's not about the yellow, but about the WP standard compliant procedure of marking rows as unapproved)

  • 1
    I have trouble following how row actions (controls) connect to row presentation (styling) in your question? – Rarst Jun 1 '13 at 12:36

Well, the yellow comes from

<tr class="unapproved">

and this is, in crass contrast to what the usual WP_List_Table introduction might suggest, not an automatism, but generated very verbatim:

See e.g. single_row() in wp-admin/includes/class-wp-comments-list-table.php:

function single_row( $a_comment ) {
                global $post, $comment;

                $comment = $a_comment;
                $the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );

                $post = get_post( $comment->comment_post_ID );

                $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );

                echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
                echo $this->single_row_columns( $comment );
                echo "</tr>\n";

which overrides the standard method inherited from wp-admin/includes/class-wp-list-table.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.