• The table shortcode was not creating an opening tr tag properly. The follow code fixes the issue.

    if( !function_exists('tboot_table_shortcode') ) {
    	function tboot_table_shortcode( $atts ) {
    		extract( shortcode_atts( array(
    			'cols' => 'none',
    			'data' => 'none',
    			'strip' => '',
    			'style' => '',
    			'border' => '',
    			'condense' => '',
    			'hover' => '',
    			), $atts ) );
    
    		$strip = ($strip == 'yes') ? 'table-striped' : '';
    		$border = ($border == 'yes') ? 'table-bordered' : '';
    		$condense = ($condense == 'yes') ? 'table-condensed' : '';
    		$hover = ($hover == 'yes') ? 'table-hover' : '';
    
    		$cols = explode(',',$cols);
    		$data = explode(',',$data);
    		$total = count($cols);
    		$total_data = count($data);
    		$output = '<table class="table ' . $strip . ' ' . $border . ' ' . $condense . ' ' . $hover . '"><tr>';
    		foreach($cols as $col):
    			$output .= '<th>'. $col . '</th>';
    		endforeach;
    		$output .= '</tr><tr>';
    		$counter = 1;
    		foreach($data as $datum):
    			$output .= '<td>'. $datum .'</td>';
    		if($counter%$total==0):
    			$output .= '</tr>';
    			if($counter < $total_data):
    				$output .= '<tr>';
    			endif;
    		endif;
    		$counter++;
    		endforeach;
    		$output .= '</table>';
    		return $output;
    	}
    	add_shortcode( 'tboot_table', 'tboot_table_shortcode' );
    }

    https://www.ads-software.com/plugins/bootstrap-shortcodes/

Viewing 1 replies (of 1 total)
  • Plugin Contributor No3x

    (@no3x)

    We don’t even support tables. Maybe you have posted to the wrong plugin page.

Viewing 1 replies (of 1 total)
  • The topic ‘Fix for invalid table structure’ is closed to new replies.