Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Johann Heyne

    (@jonua)

    You could repeat the header after an interval…

    $table = get_field( 'your_table_field_name' );
    
    if ( $table ) {
    
        echo '<table border="0">';
    
            echo '<tbody>';
    
                $i = 0;
                $header_interval = 10;
    
                foreach ( $table['body'] as $tr ) {
    
                    // header cells by interval
    
                    if ( $i === $header_interval ) {
    
                        $i = 0;
                    }
    
                    if ( $table['header'] AND $i === 0 ) {
    
                        echo '<tr>';
    
                            foreach ( $table['header'] as $th ) {
    
                                echo '<th>';
                                    echo $th['c'];
                                echo '</th>';
                            }
    
                        echo '</tr>';
    
                        $i = 0;
                    }
    
                    $i++;
    
                    // normal cells
    
                    echo '<tr>';
    
                        foreach ( $tr as $td ) {
    
                            echo '<td>';
                                echo $td['c'];
                            echo '</td>';
                        }
    
                    echo '</tr>';
                }
    
            echo '</tbody>';
    
        echo '</table>';
    }
    Thread Starter Dan Stramer

    (@danstramer)

    Thanks,
    So this is done automatically and not by the admin end?

    Dan

    Plugin Author Johann Heyne

    (@jonua)

    Right, there is no way to define any cells, rows, columns features yet.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create a TH row’ is closed to new replies.