Home › Forums › ACF PRO › Check posts for Custom Field › Reply To: Check posts for Custom Field
try something like this:
<ul class="slider">
<?php if( get_field('display_in_carousel') )
{
$image = get_field('image');
if( !empty($image) ): ?>
<li><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /></li>
<?php endif;
}
else
{
//do nothing
}
?>
</ul>
of course you need to wrap that like your slider need it (and probably change way of load image too)
or you do it with meta-query like the other part of the example
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.