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

    (@jonua)

    If you want to repeat the header by interval, you can do something like that:

    $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 pro100light

    (@pro100light)

    Hm… But y don’t have interval. It’s random.

    Plugin Author Johann Heyne

    (@jonua)

    There is no option yet for a row to define the type of that row′s cells.

    Thread Starter pro100light

    (@pro100light)

    Sorry… I will wait for the new version =) Thank you for your answer, and for a cool addon!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘two Heders in table’ is closed to new replies.