Hi @webdevmattcrom!
Thank you for your message, you’re always so helpful – I genuinely appreciate it. I’ve been trying to make the coding work and am having some trouble, when I add it using the My Custom Functions plug in, it comes up with a fatal error. I tried to change the code to be what I want it to say… I just want a simple box that says ‘Your Message:’ on ALL forms. Are you able to provide any further help or insight into what I need to paste into My Custom Functions to make this work? I would be SO grateful for any help.
Here is the code I was trying to use (it was copied from your documentation, then I changed the text where I thought to have it read ‘Your Message:’
/** * Custom Form Fields * * @param $form_id */ function give_myprefix_custom_form_fields( $form_id ) { //Only display for a specific form; //Remove “If” statement to display on all forms if ( $form_id == ‘754’ ) { ?> <div id=”give-referral-wrap”> <label class=”give-label” for=”give-referral”><?php _e( ‘Your message:’, ‘give’ ); ?></label> <span class=”give-tooltip icon icon-question” data-tooltip=”<?php _e( ‘Please take a moment to write a personal message’, ‘give’ ) ?>”></span> <textarea class=”give-textarea” name=”give_referral” id=”give-referral”></textarea> </div> <?php }//endif } add_action( ‘give_after_donation_levels’, ‘give_myprefix_custom_form_fields’, 10, 1 ); /** * Validate Custom Field * * @description check for errors without custom fields * * @param $valid_data * @param $data */ function give_myprefix_validate_custom_fields( $valid_data, $data ) { //Check that we’re validating the proper form //Remove if this is a global field if ( $data[‘give-form-id’] !== ‘754’ ) { return; } //Check for a referral data if ( empty( $data[‘give_referral’] ) ) { give_set_error( ‘give_referral’, __( ‘Please take a moment to write a personal message’, ‘give’ ) ); } } add_action( ‘give_checkout_error_checks’, ‘give_myprefix_validate_custom_fields’, 10, 2 ); /** * Add Field to Payment Meta * * @description store the custom field data in the payment meta * * @param $payment_meta * * @return mixed */ function give_myprefix_store_custom_fields( $payment_meta ) { $payment_meta[‘referral’] = isset( $_POST[‘give_referral’] ) ? implode( “n”, array_map( ‘sanitize_text_field’, explode( “n”, $_POST[‘give_referral’] ) ) ) : ”; return $payment_meta; } add_filter( ‘give_payment_meta’, ‘give_myprefix_store_custom_fields’ ); /** * Show Data in Transaction Details * * @description show the custom field(s) on the transaction page * * @param $payment_meta * @param $user_info */ function give_myprefix_purchase_details( $payment_meta, $user_info ) { //uncomment below to see payment_meta array // echo “
"; // var_dump($payment_meta); // echo "
“; //Bounce out if no data for this transaction if ( ! isset( $payment_meta[‘referral’] ) ) { return; } ?> <div class=”referral-data”> <label><?php echo __( ‘Referral:’, ‘give’ ); ?></label> <?php echo wpautop( $payment_meta[‘referral’] ); ?> </div> <?php } add_action( ‘give_payment_personal_details_list’, ‘give_myprefix_purchase_details’, 10, 2 );