
I am trying to create a table on the front-end using the ACF Table add-on. However, there doesnt seem to be the option to colspan.
https://drive.google.com/open?id=0B9gJ3yRm64DrVEYyZUthZVpKUWs
The above is what i’m trying to re-create. The only option I have found is:
https://support.advancedcustomfields.com/forums/topic/howto-build-tables-with-acf-and-merged-cells-colspan/
When I add that code to my functions.php file and add the follow table in wp-admin:
https://drive.google.com/open?id=0B9gJ3yRm64DrWEtHazBGRk5SeWs
It doesn’t work.
the code for my table is as follows:
$table = get_field( 'your_table_field_name' );
if ( $table ) {
echo '<table border="0">';
if ( $table['header'] ) {
echo '<thead>';
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>';
echo $td['c'];
echo '</td>';
}
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
Am I missing something, if so – how do I fix this? The original colspan link poster didnt really make it clear as to how to use the function.
The plugin you mentioned is from a different developer than ACF. The beset place to get help with this will be from their support forum https://wordpress.org/support/plugin/advanced-custom-fields-table-field