Support

Account

Home Forums Front-end Issues Count up of each type of flexible content used

Unread

Count up of each type of flexible content used

  • I am using flexible content to load either an image or text and I have a count so it counts up each row e.g. 1, 2, 3 etc.

    However, I want to count up the number of each flexible content so for example;

    • Image – 1
    • Text – 1
    • Image – 2
    • Image – 3
    • Text – 2

    This is the code so far;


    if( have_rows('items') ):
    $count_row = 0;
    while ( have_rows('items') ) : the_row();
    $flex_row = get_row_layout();
    $count_row++;
    echo get_template_part('includes/loops/loop_'.get_row_layout());
    endwhile;
    endif;

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.