I am helping out a local library and know next to nothing about php, but one of the wordpress plugins they are using requires me to add another form field input to be filled out.
The plugin dev provided sample code to use as a yes/no input for their forms, but I need to make it a radio input instead with the option to choose one of 3 color options - blue, red or yellow?
Hoping someone can help me alter the code below to do that.
Thank you in advance.
// BEGIN EVENTON CODE
add_filter('evoau_form_fields', 'evoautest_fields_to_form', 10, 1);
function evoautest_fields_to_form($array){
$array['evotest']=array('Test Fields', 'evotest', 'evotest','custom','');
return $array;
}
// actionUser integration
add_action('evoau_frontform_evotest', 'evoautest_fields', 10, 6);
// Frontend showing fields and saving values
function evoautest_fields($field, $event_id, $default_val, $EPMV, $opt2, $lang){
$helper = new evo_helper();
echo "<div class='row evotest'><p>";
$evoau_test_value = ($EPMV && !empty($EPMV['evoau_test_value']) && $EPMV['evoau_test_value'][0]=='yes')? true: false;
echo $helper->html_yesnobtn(array(
'id'=>'evoau_test_value',
'input'=>true,
'label'=>evo_lang_get('evoAULtest_1', 'Test Input Field', $lang, $opt2),
'var'=> ($evoau_test_value?'yes':'no'),
'lang'=>$lang,
'afterstatement'=>'evoau_test_value_section'
));
echo "</p></div>";
}
// save the values to event post meta
add_action('evoau_save_formfields', 'evoautest_save_values', 10, 3);
function evoautest_save_values($field, $fn, $created_event_id){
if( $field =='evotest'){
// for each above fields
foreach(array(
'evoau_test_value',
) as $field){
if(!empty($_POST[$field]))
add_post_meta($created_event_id, $field, $_POST[$field]);
}
}
}
// END EVENTON CODE
My Answer:
'
';_ echo ' Blue
';_ echo ' Red
';_ echo ' Yellow
';_}
Rate this post
3 of 5 based on 9457 votesComments