Hi,
Many thanks for this great plugin. What i'm trying to achieve is adding a dynamic style accourding the the amount of rows with content within the flexible field.
So if it get's 3 row layouts with content, then it will be adding "large-4" class, or if it get's 2, each one will get "large-6" class.
I tried it several times, and with this, i'm only getting a 1 1 1, but not the total or the sum. Also tried with count and so on, but probably i'm missing something.
<?php $columns = get_row_layout(); $n_rows = count( $columns ); echo $n_rows; ?>Here is the code. But not sure if with this code i'm doing it in the long/dumb way:
<?php while(has_sub_field('content_tabs_tab')): ?>
<div class="columns no-pad (conditional class here)">
<?php if(get_row_layout() == 'content_tabs_tab_textcolumn'): ?>
<?php the_sub_field('content_tabs_tab_icolumn_text'); ?>
<?php elseif(get_row_layout() == 'content_tabs_tab_imagecolumn'): ?>
<?php $attachment = get_post( get_sub_field('content_tabs_tab_icolumn_image') );
$image_id = get_sub_field('content_tabs_tab_icolumn_image');
$image = wp_get_attachment_image_src( $image_id, 'full' );
$image_title = $attachment->post_title;
echo '<img src="'. $image[0]. '" alt="'. $image_title .'" />';
?>
<?php elseif(get_row_layout() == 'column_tabs_read_more'): ?>
<?php if(get_sub_field('content_tabs_tabtirm_title')) { ?>
<h6><?php the_sub_field('content_tabs_tabtirm_title'); ?></h6> <?php } ?>
<?php if(get_sub_field('content_tabs_tabtirm_content')) { ?>
<p><?php the_sub_field('content_tabs_tabtirm_content'); ?></p>
<?php } ?> <?php if(get_sub_field('content_tabs_tabtirm_link')) { ?>
<a class="more-btn" href="<?php the_sub_field('content_tabs_tabtirm_link') ?>">Learn More</a>
<?php } ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
Thank you so much