Support

Account

Home Forums Add-ons Flexible Content Field Output multiple select fields in unordered list? Reply To: Output multiple select fields in unordered list?

  • Hi @nadgemanforum

    It’s just a matter of looping through the values (it’s an array) and output an li for each!

    This should do it:

    
    if( have_rows('flexible_content_field_name') ):
       while ( have_rows('flexible_content_field_name') ) : the_row();
    
    		if( get_row_layout() == 'likes' ):
    			$likes_list = get_sub_field('likes_list');
    			if( $likes_list ):
    				echo '<ul>';
    				foreach( $likes_list as $like ):
    					echo '<li>' . $like . '</li>';
    				endforeach;
    				echo '</ul>';
    			endif;
    			echo implode(', ', $likes_list);
            endif;
    
       endwhile;
    
    endif;
    

    Best of luck in your project!