I’m using a theme that is requiring me to write my PHP in ternary (for the output of a function I can’t use “if” statements – it says “unexpected if” – so after a bit of googling I found that I need write in ternary to avoid this).
I’m trying to include a repeater field. My code would be:
// check if the repeater field has rows of data
if( have_rows('repeater_field') ):
// loop through the rows of data
while ( have_rows('repeater_field') ) : the_row();
// display a sub field value ?>
<li><a href="<?php the_sub_field('sub_field'); ?>'" target="_blank"><?php the_sub_field('sub_field'); ?></a></li>
// no rows found
But I really don’t know where to begin with this. Could anyone help please?