Custom field on a specific donation form
-
I inserted this snippet in the functions.php file to add a custom field named “Ricorrenza in memoria” to the donation form.
Also I would like this field to be added only to the donation form with ID=“21710”.
Below is the code, but the additional field does not appear// Nuovo campo Ricorrenza in memoria per donazione, aggiunto solo al modulo con ID=21710
add_action( 'give_fields_donation_form_after_personal_info', function( $form_id ) {
// Controlla se l'ID è quello desiderato (21710)
if ( $form_id == 21710 ) {
give()->form_field_manager->add_fields(
'give_donation_form',
[
[
'type' => 'text',
'name' => 'ricorrenza_in_memoria',
'label' => __( 'Ricorrenza', 'give' ),
'placeholder' => __( 'Inserisci qui la ricorrenza', 'give' ),
'description' => __( 'Inserisci qui la ricorrenza', 'give' ),
'attributes' => [
'required' => true,
'minlength' => 2,
'maxlength' => 300,
],
'show_in_receipt' => true,
'store_as_donor_meta' => true,
]
],
$form_id
);
}
}, 10, 1);The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.