Home › Forums › General Issues › Getting an if else to work › Reply To: Getting an if else to work
I Managed to workout out, I had renamed the label on the flexible content, which ACF pro dosnt like, i had to create a new flexible content area and then re populate it. And i included the missing column container missing.
The Last Endif was needed so thank you ichabod1799
‘
<?php
// loop through the rows of data
if( have_rows(‘school_box’) ):
// add a counter
$count = 0;
$group = 0;
while ( have_rows(‘school_box’) ) : the_row();
//print(get_row_layout());
if ($count % 3 == 0) {
$group++;
?>
<div id=”<?php echo $group; ?>” class=”row group-<?php echo $group; ?>” data-equalizer> <!–Begin Row:–>
<?php
}
?>
<?php
if( get_row_layout() == ‘link_box’ ):
?>
<div class=”large-4 medium-4 columns panel” data-aos=”fade-up” data-aos-delay=”150″>
<div>” target=”_blank”>” alt=”<?php the_title(); ?>”></div>
<div class=”profile-box”>” target=”_blank”><?php echo the_sub_field(‘staff_name’); ?></div>
</div>
<?php
elseif( get_row_layout() == ‘video_box’ ):
?>
<div class=”large-4 medium-4 columns panel” data-aos=”fade-up” data-aos-delay=”150″>
<div class=”video-parent”>
<div>” target=”_blank”>” alt=”<?php the_title(); ?>”></div>
<div class=”video-inner”>
” target=”_blank”>
</div>
</div>
<div class=”profile-box”>” target=”_blank”><?php echo the_sub_field(‘staff_name’); ?></div>
</div>
<?php
endif;
if ($count % 3 == 2) {
?>
</div>
<?php
}
$count++;
endwhile;
else :
// no rows found
endif; ?>
‘
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.