Home › Forums › Front-end Issues › My if/else php not working – help! › Reply To: My if/else php not working – help!
Just solved it myself! Here’s the answer (might conceivably be of use to someone else):
<!-- slideshow -->
<?php if( have_rows('news_slideshow') ): ?>
<!-- data-ratio="820/542" -->
<div class="the-slideshow slideshow-news">
<div class="fotorama"
data-width="100%"
data-ratio="820/542"
data-minwidth="285"
data-loop="true"
data-swipe="true"
data-click="true"
data-nav="false"
data-transition="crossfade"
data-transitionduration="1500"
data-autoplay="4000">
<?php while ( have_rows('news_slideshow') ) : the_row(); ?>
<?php if( !empty(get_sub_field('news_slideshow_image')) ) : ?>
<?php
$slideLarge = get_sub_field('news_slideshow_image');
$size = 'full'; // (thumbnail, medium, large, full or custom size)
?>
<?php echo wp_get_attachment_image( $slideLarge, $size ); ?>
<?php else: ?>
<?php echo 'something else'; ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<!-- end slideshow -->
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.