Looping through repeater fields with a foreach loop
-
Hi I am trying to loop through a set of repeater fields that I have set up and populated within my post.
I am trying to implement this code on my single.php page but for some reason I am getting no output.
Anyone have any ideas?
<?php $questions_and_answers = get_post_meta($post->ID, 'question-answer', false); foreach ($questions_and_answers as $single_questions_and_answer) { echo $single_questions_and_answer . '<br />'; } ?>question-answer is my field slug.
The topic ‘Looping through repeater fields with a foreach loop’ is closed to new replies.