Support

Account

Home Forums General Issues how to display (ACF) data/values as a table? Reply To: how to display (ACF) data/values as a table?

  • Hi @ajaykasam1

    You can just output the values in a table format:

    <?php
    $firstname = get_field('firstname');
    $surname = get_field('surname');
    $year = get_field('year');
    $title = get_field('title');
    ?>
    <table class="table">
    	<thed>
    		<tr>
    			<?php if( $firstname ): ?>
    			<th scope="col">First Name</th>
    			<?php endif; ?>
    			<?php if( $surname ): ?>
    			<th scope="col">Surame</th>
    			<?php endif; ?>	
    			<?php if( $year ): ?>
    			<th scope="col">Year</th>
    			<?php endif; ?>	
    			<?php if( $title ): ?>
    			<th scope="col">Title</th>
    			<?php endif; ?>				
    		</tr>		
    	</thed>
    	<tbody>
    		<tr>
    			<?php if( $firstname ): ?>
    			<th scope="row">First Name</th>
    			<?php endif; ?>
    			<?php if( $surname ): ?>
    			<td>Surame</td>
    			<?php endif; ?>
    			<?php if( $year ): ?>
    			<td>Year</td>
    			<?php endif; ?>	
    			<?php if( $title ): ?>
    			<td>Title</td>
    			<?php endif; ?>				
    		</tr>	
    	</tbody>
    </table>