Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Matt Cromwell

    (@webdevmattcrom)

    Hi there,

    You can swap out the give_after_donation_level action with any of the following instead:

    1. give_purchase_form_after_personal_info
    2. give_payment_mode_after_gateways
    3. give_purchase_form_after_email

    Thanks!

    Hello,

    How do I accomplish this as a non-developer? I can follow along and place code as instructed, but I don’t know where to put it. We are a non-profit looking to create the ability for users to be able to select what they want their donation to be attributed to. We would create a dropdown list with a number of fixed options.

    Thanks for any assistance you can provide.

    -Alex

    Plugin Contributor Devin Walker

    (@dlocc)

    Hey hey,

    We put together this article to help you insert custom functions safely: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    The easiest way as a non-developer is to use our Form Field Manager Add-on. However, we understand not everyone has budget for this so that’s why we provide the code alternative.

    Please let me know if you have anymore questions!

    Thread Starter zdavis

    (@zdavis)

    To be clear for anyone else who may read this I used this code

    function give_donation_custom_form_fields( $form_id ) {
    
    	//Add "If" statement to display for a specific form
    		?>
            <p id="give-fund-wrap" class="form-row form-row-wide">
    			<label class="give-label" for="give-fund"><?php _e( 'What fund would you like this to go towards?', 'give' ); ?>
    			<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'If you dont have a specific fund please leave blank', 'give' ) ?>"></span></label>
    			<textarea class="give-textarea" name="give_fund" id="give-fund" placeholder="What fund would you like this to go towards?" ></textarea>
    		</p>
    	<?php
    }
    
    add_action( 'give_purchase_form_after_email', 'give_donation_custom_form_fields', 10, 1 );

    I slightly changed it from the custom fields instructions for what I needed because the div was covering my form and making other fields uneditable as well as giving some unwanted spacing. Thanks for the
    give_purchase_form_after_email

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding custom field’ is closed to new replies.