Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter janrussel

    (@janrussel)

    I modified the file table-maker/inc/class-wpsm-table-maker.php to add a class to the <tr> tag based on the row number.

    I replaced
    in_array($i, $sub_array) ? ‘<tr class=”subheader”>’ : ‘<tr>’;

    with
    echo in_array($i, $sub_array) ? ‘<tr class=”subheader tm-row’ . $i . ‘”>’ : ‘<tr class=”tm-row’ . $i .'”>’;

    so that I could style the rows in CSS with something like:

    .tbl-my-table .tm-row4 td
    {
    background-color:#ccffff;
    }

    Would it be possible to incorporate this type of change into your plugin? Would you also consider adding a “change row colour” option/button for each row to the backend?

    Plugin Contributor wpsoul

    (@wpsoul)

    This useless because you can use nth-child.

    For example, for style 4 row

    .wpsm-comptable tr:nth-child(4) td

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add background color to table row’ is closed to new replies.