You can set different style classes in the table element.
CSS
.style1.table {
/* your first table styles */
}
.style2.table {
/* your second table styles */
}
HTML
<table class="style1 table">
<!--table row and cell elements -->
</table>
<table class="style2 table">
<!--table row and cell elements -->
</table>
And then you could use an “choice” field next to the table field in the repeater to let the user choose style1
or style2
.
PHP
// loop through the repeater rows of data
while ( have_rows( 'repeater_field_name' ) ) : the_row();
// get the table style choice fields value
$tablestyle = get_sub_field( 'tablestyle' );
$table = get_sub_field( 'your_table_field_name' );
if ( $table ) {
echo '<table class="' . $tablestyle . ' table">';
// other table elements
echo '</table>';
}
endwhile;