I’m working on a WordPress site and am using a plugin called ‘Simple Fields’, to add data to repeatable fields. I’ve entered data into three fields: (audioinfo, audiofile, audiocomposer).
I would now like to create a post that displays that information in the following way:
Audio Info 1
Audio File 1
Audio Composer 1
Audio Info 2
Audio File 2
Audio Composer 2
I’ve been trying to figure this out with foreach. Here’s the closest I can arrive at (thought I know it’s invalid). Can anyone make any suggestions of how to handle this?
(Just as a side note, in case it’s important, the first three lines appear to all be valid – that is, if I do a “foreach” on $audiocomposer alone, I successfully get: Bach Handel Beethoven.)
Is there something I can do to apply “foreach” to all three at the same time?
Assuming all the arrays of same length, making use of a normal for loop.
<?php $audioinfo = simple_fields_values("audioinfo"); $audiofile = simple_fields_values("audiofile"); $audiocomposer = simple_fields_values("audiocomposer"); for($i=0;$i