Home › Forums › General Issues › Radio Button Values › Reply To: Radio Button Values
@ladygeekgeek
I needed a radio button choice of Vimeo Video or Image for a slider.
I did this:
<?php if(get_field('hero_slider_slide','option')): ?>
<ul class="slides">
<?php while(has_sub_field('hero_slider_slide','option')): ?>
<?php if (get_sub_field('hero_slider_video_or_image', 'option') == 'Vimeo Video') { ?>
<li>
<?php echo '<iframe id="player_1" src="http://player.vimeo.com/video/'. get_sub_field('hero_slider_vimeo_video','option') .'?api=1&player_id=player_1" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>' ?>
</li>
<?php } else if (get_sub_field('hero_slider_video_or_image', 'option') == 'Image') { ?>
<li>
<img alt="<?php echo $alt; ?>" src="<?php echo $image[0]; ?>" />
<div class="grid-container">
<div class="grid-100 tablet-grid-100 hero-caption">
<p class="tagline"><?php the_sub_field('hero_slider_slide_caption', 'option'); ?></p>
</div>
</div>
</li>
<?php } ?>
<?php endwhile; ?>
</ul>
<?php 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!
✨ You can now install ACF PRO with Composer, eliminating the need for third-party installers. Get the details and instructions here. https://t.co/ebEfp60Pwj
— Advanced Custom Fields (@wp_acf) February 2, 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.