Display repeated fields
-
Hello, I’ve been trying to display the repeated data into a table but couldn’t find any example on your youtube channel or here, maybe I missed something.
I have the data in an array
$array = array( get_post_meta( get_the_ID(), 'data1', true ), get_post_meta( get_the_ID(), 'data2', true ), get_post_meta( get_the_ID(), 'data3', true ), );and I’m trying to put it into a table:
echo '<table class="table-group">'; foreach ( $array as $row ) { echo('<tr>'); echo('<td>'); echo( implode( '</td><td>', $row ) ); echo('</td>'); echo('</tr>'); } echo '</table>';The table works, it shows the data but not in the order I want.. it puts all the results of data1…data3 in a column instead of a row. The problem is I’m not sure how I can select the first entry in the array to correspond with the second array’s first entry and so forth. I hope it makes sense?
If this is all wrong kindly refer to me how I would be able to display repeated fields data in a table. Thank you again.
The topic ‘Display repeated fields’ is closed to new replies.