Support

Account

Home Forums Add-ons Repeater Field repeater field with schema.org FAQPage Reply To: repeater field with schema.org FAQPage

  • <?php if( have_rows(‘faqs’) ): ?>
    <?php $faqSchema = ”;
    while( have_rows(‘faqs’) ): the_row();
    $faqSchema .= ‘{

    “@type”: “Question”,
    “name”: “‘.get_sub_field(‘heading’).'”,
    “acceptedAnswer”: {
    “@type”: “Answer”,
    “text”: “‘.get_sub_field(‘content’).'”
    } },’;
    endwhile;
    ?>
    <script type=”application/ld+json”>

    {
    “@context”: “https://schema.org”,

    “@type”: “FAQPage”,
    “mainEntity”:[
    <?php echo rtrim($faqSchema,’,’); ?>
    ]
    }
    <?php endif; ?>
    </script>