FAQs


‘;
if($style === “checks”) {
$count = 1;
$total = count(get_field(‘faqs’, $post_id));
echo ‘

‘;
while (have_rows(‘faqs’, $post_id)) {
the_row();
$heading = get_sub_field(‘question’);
$text = get_sub_field(‘answer’);
$ai_q = get_sub_field(‘ai_question’);
$ai_a = get_sub_field(‘ai_answer’);

if($ai_q && $ai_a) {
$faq_structured[] = [
“@type” => “Question”,
“name” => $ai_q,
“acceptedAnswer” => [
“@type” => “Answer”,
“text” => $ai_a
]
];
}

if($count == (floor($total / 2) + 1)) {
echo ‘

‘;
}
?>

‘;
while (have_rows(‘faqs’, $post_id)) {
the_row();
$heading = get_sub_field(‘question’);
$text = get_sub_field(‘answer’);
$icon = get_sub_field(‘icon’);
$ai_q = get_sub_field(‘ai_question’);
$ai_a = get_sub_field(‘ai_answer’);

if($ai_q && $ai_a) {
$faq_structured[] = [
“@type” => “Question”,
“name” => $ai_q,
“acceptedAnswer” => [
“@type” => “Answer”,
“text” => $ai_a
]
];
}
?>

‘;
$count = 1;
$total = count(get_field(‘faqs’, $post_id));
if($style === “accordion-2-column”) {
echo ‘

‘;
}
while (have_rows(‘faqs’, $post_id)) {
the_row();
$accordion_title = get_sub_field(‘question’);
$accordion_body = get_sub_field(‘answer’);
$collapse_id = ‘flush-collapse’ . $post_id . ‘-‘ . $count;
$ai_q = get_sub_field(‘ai_question’);
$ai_a = get_sub_field(‘ai_answer’);

if($ai_q && $ai_a) {
$faq_structured[] = [
“@type” => “Question”,
“name” => $ai_q,
“acceptedAnswer” => [
“@type” => “Answer”,
“text” => $ai_a
]
];
}

if($style === “accordion-2-column” && ($count == (floor($total / 2) + 2))) {
echo ‘

‘;
}
?>

‘;
}
}
echo ‘

‘;
}
?>