Hello,
How can i load repeater values in a custom plugin?
- ACF is loaded before this function (plugins load order)
- get_field('abonnementen', 'options') returns no values (in
<
pre> tags) - get_field_object return no values - get_option displays a the value specified
My function:
` public static function getDropdownAbonnementen( $args = false ){
$options = array();
if( get_field('abonnementen', 'options') ):
while( has_sub_field('abonnementen','options') ):
if( get_sub_field('abonnement') != 1 ){
$price = ' €'. get_sub_field('prijs');
}
else
$price = '';
$option_title = get_sub_field('abonnement_naam') . $price;
$options[ get_sub_field('abonnement') ]['option_key'] = get_sub_field('abonnement');
$options[ get_sub_field('abonnement') ]['option_label'] = trim($option_title);
// selected?
/*if( isset( $args['selected'] ) ){
if( is_array( $args['selected']['max_afstand_tot_opdracht'] ) ){
if( isset( $args['selected']['max_afstand_tot_opdracht'][ $options[sanitize_title_with_dashes($option_title)]['option_key'] ]) ){
$options[sanitize_title_with_dashes($option_title)]['option_selected'] = 1;
}
}
}*/
endwhile;
endif;
return $options;
}
`