If you need to modify the add obituary form you can use the following filter
apply_filters('wpfh/add_obit/form_after', $form);
This filter allows you to take the form and output fields in your own form. Here is an example
<?php
#build the form
add_filter('wpfh/add_obit/form_after' ,'my_custom_form',10,2);
#save the form
add_filter('wpfh/add_obit/insert', 'my_custom_form_save',10,2);
function my_custom_form($form,$post){
#create a new form below or use the form object above to add new fields
$new_form = ' <p class="two_column ">
<label >'.__("New Field","sp-wpfh").' <span class="wpfh-required">*</span></label>
<input id="new_field" name="new_field" value="'.$post['new_field'].'"/>
</p>
<p class="two_column ">
<label>'.__("New Field 2","sp-wpfh").' <span class="wpfh-required">*</span></label>
<input id="new_field2" name="new_field2" value="'.$post['new_field2'].'"/>
</p>
';
return $new_form;
}
function my_custom_form_save($insert,$post){
#do something with your data
$insert['new_field'] = sanitize_text_field($post['new_field']);
$insert['new_field'] = sanitize_text_field($post['new_field']);
return $insert;
}
?>
The filter allows you to extend the fields or overwrite the field completely
Anthony Brown
Comments