Support

Account

Home Forums Add-ons Repeater Field Displaying repeater accordian content

Unread

Displaying repeater accordian content

  • Hi,

    I have created a field group and within here I have created a faq accordion repeater. I am trying to print out the contents of this repeater on my website front end but having followed various tutorials online I can’t get this to work.

    The code I am using is shown below. At present nothing is displayed. Can anyone help please?

    `<?php

    // check if the repeater field has rows of data
    if(have_rows(‘content_faqs’) ):

    echo “check”;
    // loop through the rows of data for the tab header
    while ( have_rows(‘content_faqs’) ) : the_row();

    $header = get_sub_field(‘faq_question’);
    $content = get_sub_field(‘faq_answer’);

    ?>

    <button class=”accordion”><?php echo $header; ?></button>
    <div class=”panel”>
    <p><?php echo $content; ?></p>
    </div>
    <?php
    endwhile; //End the loop

    else :

    // no rows found

    endif; ?>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.