Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $table = get_field( 'custom_table' );
- if ( ! empty ( $table ) ) {
- echo '<table class="custom-table" border="0">';
- if ( ! empty( $table['caption'] ) ) {
- echo '<caption>' . $table['caption'] . '</caption>';
- }
- if ( ! empty( $table['header'] ) ) {
- echo '<thead class="table-heading">';
- echo '<tr>';
- foreach ( $table['header'] as $th ) {
- echo '<th>';
- echo $th['c'];
- echo '</th>';
- }
- echo '</tr>';
- echo '</thead>';
- }
- echo '<tbody>';
- foreach ( $table['body'] as $tr ) {
- echo '<tr>';
- foreach ( $tr as $td ) {
- echo '<td data-th="'. $th['c'] .'">';
- echo $td['c'];
- echo '</td>';
- }
- echo '</tr>';
- }
- echo '</tbody>';
- echo '</table>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment