Support

Account

Home Forums Add-ons Repeater Field Sort repeater fields by radio button subfield

Solved

Sort repeater fields by radio button subfield

  • After searching this forum I still don’t know for sure if this is possible or not.
    Earlier I created repeater fields for a specific page to create users with certain information. Information is created through various subfields. This works fine.

    Today the request came for the option to be able to filter these fields in one of three options. I thought radiobuttons would be ideal for the end-user to filter. One or more fields can only belong to one of these three values.

    The method explained here (advanced) comes close, but since I need to sort this in three rows I was wondering if this is possible, anyone has ever done this yet? Or is there a better alternative for using radiobuttons? Thank you in advance!

  • Thanks to the suggestion bij Deej on this thread I managed to work this out.

    $repeater = get_field('recensie');
    foreach ($repeater as $key => $row) {
    	$recensent[$key] = $row['recensent'];
    	$recensent_functie[$key] = $row['recensent_functie'];
    	$recensent_link[$key] = $row['recensent_linkedin'];
    	$recensent_foto[$key] = $row['recensent_foto'];
    	$recensent_tekst[$key] = $row['recensie_tekst'];
    	$recensie_type[$key] = $row['recensie_type'];
    }
    array_multisort($recensie_type, SORT_ASC, $repeater);
    foreach( $repeater as $row ) { 
    
    	// styling for each field
    
    } ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Sort repeater fields by radio button subfield’ is closed to new replies.