Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

Add Class to table data cell

Is there a way to programmatically add a class to a generated table data cell on a custom column from the returned value for that cell?

I am in a situation where I need to style the row output based on data in a certain cell, but I do not have anything unique to ‘hook’ on to, the generated classes only contain the field-name.


8 years, 2 months ago
Stefan van den Dungen Gronovius

Hi Toni,

I think this is not possible.
The classes on the table cells are determined by WordPress based on the name (you already figure that out).
You could use javascript to add a custom class to the table cell but you probably see a short delay.

Another approach is to wrap each value in a new container by using this filter. Then you can check some properties of the column and do something like this:

$value = '<div class="customclass">' . $value . '</div>';

8 years, 2 months ago

You must be logged in to reply to this topic.