Support » Plugins and Hacks » Repeatable field and conditional logic

Repeatable field and conditional logic

  • Hi all,

    I am using ACF for some straightforward frontend output, all I am try to do is output a series of clients, some have case studies on my site, some don’t. At the minute, my code always displays a link, even if a case study doesn’t exist. I just need some help in adding some conditional logic so that the link doesn’t show if there isn’t a case study.

    <?php if(get_field('clients')): ?>
    			<div class="col clients boxed">
    					<ul id="client-list">
    				<?php while(has_sub_field('clients')): ?>
    							<a href="<?php the_sub_field('case_study_page'); ?>">
    							<?php the_sub_field('client_name'); ?>
    				<?php endwhile; ?>
    			<?php endif; ?>

    Appreciate any help.



  • The topic ‘Repeatable field and conditional logic’ is closed to new replies.