/** * Add a short summary after the donation details showing the funds raised by each campaign. */ function ed_add_campaign_stats_to_receipt($donation) { $campaigns = $donation->get_campaign_donations(); ob_start(); printf('<h4>%s</h4>', __('Campaign Stats')); foreach ($campaigns as $campaign_donation) { $campaign = charitable_get_campaign($campaign_donation->campaign_id); printf('<p><strong>%s</strong></p>', $campaign_donation->campaign_name); charitable_template_campaign_donation_summary($campaign); } echo ob_get_clean(); }
* Display a widget with a link to donate to a campaign. * * Override this template by copying it to yourtheme/charitable/widgets/donate.php * * @author Studio 164a * @since 1.0.0 */ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly if (!charitable_is_campaign_page() && 'current' == $view_args['campaign_id']) { return; } $widget_title = apply_filters('widget_title', $view_args['title']); $campaign_id = 'current' == $view_args['campaign_id'] ? get_the_ID() : $view_args['campaign_id']; $campaign = charitable_get_campaign($campaign_id); if ($campaign->has_ended()) { return; } $suggested_donations = $campaign->get_suggested_donations(); if (empty($suggested_donations) && !$campaign->get('allow_custom_donations')) { return; } echo $view_args['before_widget']; if (!empty($widget_title)) { echo $view_args['before_title'] . $widget_title . $view_args['after_title']; } $form = new Charitable_Donation_Amount_Form($campaign); $form->render(); echo $view_args['after_widget'];
/** * Renders a benefactors addon metabox. Used by any plugin that utilizes the Benefactors Addon. * * @since 1.0.0 * @author Eric Daams * @package Charitable/Admin Views/Metaboxes * @copyright Copyright (c) 2015, Studio 164a */ global $post; if (!isset($view_args['extension'])) { _doing_it_wrong('charitable_campaign_meta_boxes', 'Campaign benefactors metabox requires an extension argument.', '1.0.0'); return; } $extension = $view_args['extension']; $benefactors = charitable_get_table('benefactors')->get_campaign_benefactors_by_extension($post->ID, $extension); $ended = charitable_get_campaign($post->ID)->has_ended(); ?> <div class="charitable-metabox charitable-metabox-wrap"> <?php if (empty($benefactors)) { if ($ended) { ?> <p><?php _e('You did not add any contribution rules.', 'charitable'); ?> </p> <?php } else { ?>