Title: Extra CSS Classes per row
Last modified: August 21, 2016

---

# Extra CSS Classes per row

 *  Resolved [Scottomalley](https://wordpress.org/support/users/scottomalley/)
 * (@scottomalley)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/extra-css-classes-per-row/)
 * I’m looking for advice on extending Tablepress to allow Extra CSS on a per row
   basis. similar to how it is done on the table level at present.
 * Do you know of any plugins that would allow this, or could you point me at what
   files I would need to edit and extend to let this happen?
 * I would use the current row css selectors, but I won’t be the one using this 
   install and the person using it is not a programmer, I’m hoping to add a dropdown
   of the css classes I’ve added and just let the user select the correct one.
 * Cheers for the help
 * Scott
 * [http://wordpress.org/plugins/tablepress/](http://wordpress.org/plugins/tablepress/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/extra-css-classes-per-row/#post-4065532)
 * Hi Scott,
 * thanks for your question.
 * I see what you are trying to do, but at this time, I’d like to discourage you
   from doing this.
    Adding such function to TablePress would require changes in
   almost all parts of the plugin, including table loading, user interface, saving
   and rendering. This will be a real mess, as not all these places offer plugin
   filter hooks or actions at this time that could be used. You would therefore 
   have to modify plugin files directly, which is bad, as you would have to re-apply
   those changes after every update.
 * Instead, I’d like to suggest a similar method/workaround. It’s kind of hacky,
   but it should work even for inexperienced users.
    There’s a TablePress Extension
   that can highlight rows based on its content that you can download from [http://tablepress.org/download/extension/tablepress-row-highlighting.zip](http://tablepress.org/download/extension/tablepress-row-highlighting.zip)
 * The basic concept is explained in this thread: [http://wordpress.org/support/topic/highlight-a-row-based-on-value](http://wordpress.org/support/topic/highlight-a-row-based-on-value)
 * In your case, let’s say you have the CSS classes “one”, “two”, and “three” that
   you want the user to attach to a row.
    Then, you would add a new first column
   to the table where the user would enter the CSS class that he wants to apply (
   this is basically the replacement of the dropdown that you mention). To hide 
   this column from the site visitors, you can add this “Custom CSS”:
 *     ```
       .tablepress-id-123 .column-1 {
         display: none;
       }
       ```
   
 * Then, change the Shortcode of the table to
 *     ```
       [table id=123 row_highlight="one||two||three" /]
       ```
   
 * to tell the Row Highlighting Extension what to look for.
    This will then add (
   slightly adjusted) CSS classes to the rows, that you can style via “Custom CSS”:
 *     ```
       .tablepress-id-123 .row-highlight-one td {
         background-color: #ff0000 !important;
       }
       .tablepress-id-123 .row-highlight-two td {
         background-color: #00ff00 !important;
       }
       .tablepress-id-123 .row-highlight-three td {
         background-color: #0000ff !important;
       }
       ```
   
 * Regards,
    Tobias

Viewing 1 replies (of 1 total)

The topic ‘Extra CSS Classes per row’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [Extra CSS](https://wordpress.org/support/topic-tag/extra-css/)
 * [row](https://wordpress.org/support/topic-tag/row/)

 * 1 reply
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/extra-css-classes-per-row/#post-4065532)
 * Status: resolved