Hi,
thanks for your question, and sorry for the trouble.
If you want to use PHP, you could use a plugin filter hook, like tablepress_row_css_class defined at https://github.com/TobiasBg/TablePress/blob/master/classes/class-render.php#L702
You could maybe also try the approach from https://wordpress.org/support/topic/highlight-a-row-based-on-value/
Regards,
Tobias
Hello Tobias,
thanks again :). The GitHub link should be the solution. Now I must evaluate how to set the apply_filters args. That should take a while but I will make it work (I hope).
Cheers and have a nice Sunday
Sascha
Before searching for a long time:
How do I get the $row_cells value?
Hi,
good to hear that this works 🙂
Best wishes,
Tobias
Hello Tobias,
now it really works! My solution:
add_filter( 'tablepress_row_css_class', 'add_table_row_classes', 10, 5 );
function add_table_row_classes( $row_classes, $table_id, $row_cells, $row_idx, $row_data ) {
switch ( $table_id ) {
case 'the-table-id':
if ( in_array( $row_idx, $GLOBALS['tablepress_row']['ids'] ) )
$row_classes .= ' ' . $GLOBALS['tablepress_row']['css_classes'];
break;
}
return $row_classes;
}
I need the variable $GLOBALS['tablepress_row'] (initialized in tablepress_table_render_data function) to pass parameters to add_table_row_classes function.
Now I can use simple css like:
#tablepress-the-table-id tr.example-class td {
background-color: moccasin !important;
}
Great! Thank you very very much :). Have a nice week
Cheers
Sascha
Hi Sascha,
very nice! Thanks for sharing this solution!
Best wishes,
Tobias