Support » Plugin: Block Lab » Repeater – row-index

Viewing 4 replies - 1 through 4 (of 4 total)
  • Update: I solved it with two loops and a counter-variable. It was for an automatic structured data faq-markup:

    $j = $i; // i=counter of the first loop
    $i = 1;
    <!– JSON-LD FAQ-Markup –>
    global $wp;
    $url = home_url( $wp->request );
    if(block_rows(‘faqfrage’)): ?>

    <script type = “application/ld+json”> {
    “@context”: “;,
    “@type”: “FAQPage”,
    “name”: “<?php echo $url;?>”,
    “mainEntity”: [
    “@type”: “Question”,
    “name”: “<?php block_sub_field(‘frage’);?>”,
    “answerCount”: 1,
    “acceptedAnswer”: {
    “@type”: “Answer”,
    “text”: “<?php block_sub_field(‘antwort’);?>”} }
    $i = $i+1;
    echo “,”; }
    <?php endif;?>

    Plugin Author Ryan Kienstra


    Hi @max2411,
    Thanks for bringing this up, and thanks for posting your solution.

    You probably saw this, but there’s no function now that gets the index of a row.

    Plugin Author Luke Carbis


    @max2411 We just created a pull request to add this functionality – check it out here:

    Hopefully we’ll have the functions block_row_count( $name ) and block_row_index() in the next release.

    Very cool, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.