\

FDIC-Insured – Backed by the full faith and credit of the U.S. Government

FDIC-Insured – Backed by the full faith and credit of the U.S. Government

February 18, 2025

Rates Table

'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five'
];
$rates = get_fields($post_id);
$tables = $rates['table'];
$legalText = "";
if ( $tables ) {
foreach ($tables as $table) {
$sections = $table['sections'];
foreach ( $sections as $section ) {
if ( $section['acf_fc_layout'] == 'table_section' ) {
$legalText = $section['table_legal_text'];
//basic table display - for more advanced look at the functions.php collapse or rates functions
$table_data = $section['table_data'];
if ( ! empty ( $table_data ) ) {
$column_count = count($table_data['header']);
$className = $numbers[$column_count].'-columns';
echo '

'; // Hide on mobile
echo '

';
if ( ! empty( $section['table_legal_text'] ) ) {
echo '

';
}
if ( ! empty( $table_data['header'] ) ) {

echo '

';
echo '

';
foreach ( $table_data['header'] as $th ) {
echo '

';
}
echo '

';
echo '

';
}
echo '

';
foreach ( $table_data['body'] as $tr ) {
echo '

';
$a = 0;
foreach ( $tr as $td ) {
$a++;
if($a == 1)
echo '

";
else
echo '

";
}
echo '

';
}
echo '

';
echo '

' . $legalText . '
';
echo $th['c'];
echo '
'.$td['c']." '.$td['c']."

';
// Mobile Collapsible Table
echo '

'; // Hide on desktop
$rowIndex = 0;
foreach ($table_data['body'] as $tr) {
$firstColumn = $tr[0]['c']; // Get the first column as the collapse button text
$collapseId = 'collapseRow' . $rowIndex;
echo '

';
echo '

';
echo '

';
echo '';
echo '

';
echo '

';
echo '

';
echo '

';

// Output remaining columns as key-value pairs
$colIndex = 0;
foreach ($table_data['header'] as $th) {
if ($colIndex > 0) { // Skip first column (Term)
echo '

';
echo '

';
echo '

';
echo '

';
}
$colIndex++;
}
echo '

' . $th['c'] . ' ' . $tr[$colIndex]['c'] . '

';
echo '

';
echo '

';
echo '

';
echo '

';
$rowIndex++;
}
echo '

'.$legalText.'

';
echo '

'; // End mobile section
}
//end rates table here
}
}
}
}
?>

Categories