This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'charitable_campaign_submission_fields', | |
function( $fields, $form ) { | |
$waiver_fields = array( | |
'legend' => 'Liability Waiver and Release', | |
'type' => 'fieldset', | |
'fields' => array( | |
'waiver' => array( | |
'type' => 'paragraph', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In this example, we add a custom field to campaigns, which is | |
* automatically included in the Donations export for donations | |
* to those campaigns. | |
*/ | |
add_action( | |
'init', | |
function() { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'charitable_fundraiser_submission_campaign_fields', function( $fields, Charitable_Ambassadors_Fundraiser_Form $form ) { | |
$parent_fields = $form->get_sanitized_campaign_form_fields( 'campaign-details' ); | |
$fields['categories'] = $parent_fields['categories']; | |
return $fields; | |
}, 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to add a new field. | |
* | |
* Available sections: | |
* | |
* - recipient_fields | |
* - campaign_fields | |
* - user_fields | |
* - fundraiser_type_selection_fields |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'charitable_campaign_donated_amount', | |
function( $amount, $campaign, $sanitize ) { | |
$new_campaign = 14; | |
$old_campaign = 135; | |
$old_goal = charitable_get_campaign( $old_campaign )->get_goal(); | |
if ( $new_campaign == $campaign->ID ) { | |
// Get the combined total of the old & new campaigns. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This example shows how to add extra fields of information to the Funds Recipient | |
* tab, which is displayed for all campaigns in the admin. | |
* | |
* In the example below, all of the fields in the User Details section of the frontend | |
* campaign form are added to the table. If you only want to add one or two fields, | |
* you can add them as follows: | |
$key = 'field-you-want-to-add'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( | |
'init', | |
function() { | |
$campaign_manager = get_role( 'campaign_manager' ); | |
$editor = get_role( 'editor' ); | |
foreach ( $campaign_manager->capabilities as $cap => $has_cap ) { | |
if ( ! $has_cap ) { | |
continue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'charitable_campaign_submission_donation_options_fields', | |
function( $fields, $form ) { | |
$fields['suggested_donations']['value'] = $form->get_campaign_value( 'suggested_amounts' ); | |
return $fields; | |
}, | |
10, | |
2 | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* If you have a custom donation field where donors can | |
* enter their organization name, you may want to display | |
* the organization name instead of the donor's name | |
* in the donor widget/shortcode. | |
* | |
* @param string $name The donor's name. | |
* @param array $view_args A collection of arguments passed to the view. | |
* This includes the Charitable_Donor instance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In Easy Digital Downloads, you can add your own email tags to include | |
* in purchase receipts & notifications. | |
* | |
* In this example, we add a tag that allows you to display the value of | |
* a custom 'campaign_email_content' field in Charitable. This is an optional | |
* follow-up to a tutorial published on our blog. | |
* | |
* @see https://www.wpcharitable.com/tutorial-how-to-add-campaign-specific-content-to-the-donation-receipt-email/ |