Home › Forums › Add-ons › Repeater Field › Troubles with true/false in repeater › Reply To: Troubles with true/false in repeater
could you try this (use have_rows and a wile loop instead of your foreach loop) :
<aside class="widget">
<?php
if( have_rows('tool_section_links') ):
echo '<h2>Tools</h2>';
echo '<ul>';
while( have_rows('tool_section_links') ): the_row();
$show_desktop = get_sub_field('show_desktop');
$tool_link = get_sub_field('tool_link');
$tool_link_title = get_sub_field('tool_link_title');
if ($show_desktop == 'yes'){
echo '<li class="show-for-large-up"><a href="'.$tool_link.'">'.$tool_link_title.'</a></li>';
} else {
echo '<li><a href="'.$tool_link.'">'.$tool_link_title.'</a></li>';
}
endwhile;
echo '</ul>';
endif;
?>
</aside>
depend on witch fieldtype you use change if ($show_desktop == 'yes')
to correct value
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.