ACF TABLE

投稿のループ内に入れます。「table_test」は、フィールド名になります。

add onなので、acfとは別にインストール必要です。

<?php		
	$table = get_field( 'table_test' );
	if ( ! empty ( $table ) ) {
		echo '<table border="0">';
  		if ( ! empty( $table['caption'] ) ) {
  			echo '<caption>' . $table['caption'] . '</caption>';
  		}
  		if ( ! empty( $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>';
	}
?>						

Contact

お問い合わせ
CMS対応のWebサイト作成は、
是非CXG DESIGNへご検討ください。