Guest User

Untitled

a guest
Nov 29th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. $table = get_field( 'custom_table' );
  3. if ( ! empty ( $table ) ) {
  4. echo '<table class="custom-table" border="0">';
  5. if ( ! empty( $table['caption'] ) ) {
  6. echo '<caption>' . $table['caption'] . '</caption>';
  7. }
  8. if ( ! empty( $table['header'] ) ) {
  9. echo '<thead class="table-heading">';
  10. echo '<tr>';
  11. foreach ( $table['header'] as $th ) {
  12. echo '<th>';
  13. echo $th['c'];
  14. echo '</th>';
  15. }
  16. echo '</tr>';
  17. echo '</thead>';
  18. }
  19. echo '<tbody>';
  20. foreach ( $table['body'] as $tr ) {
  21. echo '<tr>';
  22. foreach ( $tr as $td ) {
  23. echo '<td data-th="'. $th['c'] .'">';
  24. echo $td['c'];
  25. echo '</td>';
  26. }
  27. echo '</tr>';
  28. }
  29. echo '</tbody>';
  30. echo '</table>';
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment