Brigadier Feature Table
// Add Shortcode
function ark_brigadier_table() {
global $product;
$output = "";
if(get_field('floorplan')!=""){
$output .= '
<div id="tabs">
<ul>
<li><a href="#tabs-1">Floorplan</a></li>
<li><a href="#tabs-2">Features</a></li>
</ul>
<section id="tabs-1" class="floorplan">
<figure class="image"><img src="'.get_field('floorplan').'" alt="The Lincoln Floorplan"></figure>
</section>
';
}
$table_id= get_field( 'features_table' );
if($table_id!=""){
$table = get_field( 'details',$table_id );
} else {
$table = get_field( 'details' );
}
if(get_field('details')!=""){
$output .= '<section id="tabs-2" class="details_table">
<figure class="table_single_details">';
if ( $table ) {
$output .= '<table border="0">';
if ( $table['header'] ) {
$output .= '<thead>';
$output .= '<tr>';
foreach ( $table['header'] as $th ) {
$output .= '<th>';
$output .= $th['c'];
$output .= '</th>';
}
$output .= '</tr>';
$output .= '</thead>';
}
$output .= '<tbody>';
foreach ( $table['body'] as $tr ) {
$output .= '<tr>';
foreach ( $tr as $td ) {
$output .= '<td>';
$output .= $td['c'];
$output .= '</td>';
}
$output .= '</tr>';
}
$output .= '</tbody>';
$output .= '</table>';
}
$output .='
</figure>
</section> </div>';
return $output;
}
}
add_shortcode( 'brigadiertable', 'ark_brigadier_table' );