Add Featured Image

/** * Add a featured image to the individual campaign pages. * * @param Charitable_Campaign $campaign */ function en_add_campaign_featured_image( Charitable_Campaign $campaign ) { if ( has_post_thumbnail( $campaign->ID ) ) { the_post_thumbnail( $campaign->ID ); } } add_action( ‘charitable_campaign_content_before’, ‘en_add_campaign_featured_image’, 2 );Continue reading

Make Donor Address Required

/** * Make all address fields required. * * As of Charitable 1.6 the approach below is the recommended way of achieving this. * If you are using an older version of Charitable, see the legacy version below: * *…Continue reading

Add Empty Option To Countries List

/** * In this example we add an empty “Select your country” * option at the start of the list of countries in the * donation form. */ add_action( ‘init’, function() { $fields = charitable()->donation_fields(); $field = $fields->get_field( ‘country’ );…Continue reading

Change Section Headers Per Campaign

/** * Change the section headers in the donation form. * * @param array $fields All the donation form fields. * @return array */ function ed_charitable_change_donation_form_section_headers_per_campaign( $fields, $form ) { if ( 123 === $form->get_campaign()->ID ) { // Section headers…Continue reading

Allow Zero Dollar Donations

/** * Allow people to “donate” $0. */ function ed_charitable_set_minimum_donation_amount() { return 0; } add_filter( ‘charitable_minimum_donation_amount’, ‘ed_charitable_set_minimum_donation_amount’ ); /** * You need to specifically enable $0 donations. */ add_filter( ‘charitable_permit_0_donation’, ‘__return_true’ );Continue reading

Add User Field

/** * This adds a field to the end of the “Your Details” section in the Profile form. * * In this example, we add a Birthday field, which is a date field. * * @param array $fields * @param…Continue reading

Remove Organisation Field

/** * Remove “organisation” from the profile form. */ function ed_remove_organisation_from_profile( $fields ) { unset( $fields[ ‘organisation’ ] ); return $fields; } add_filter( ‘charitable_user_fields’, ‘ed_remove_organisation_from_profile’ );Continue reading

Remove Section

/** * You may decide that you do not need some of the sections in the Profile form at all. * This code will allow you to remove an entire section. * * If you just want to remove individual…Continue reading