PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / templates / donation-stats.php

donation-stats.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at templates/donation-stats.php

81 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Display the site donation stats.
10 *
11 * Override this template by copying it to yourtheme/charitable/donation-stats.php
12 *
13 * @package Charitable/Templates/Widgets
14 * @author WP Charitable LLC
15 * @since 1.5.0
16 * @version 1.6.57
17 * @version 1.8.8.6
18 */
19
20 /**
21 * Do something before displaying the donation stats.
22 *
23 * @since 1.6.57
24 *
25 * @param array $view_args The view arguments.
26 */
27 do_action( 'charitable_donation_stats_before', $view_args );
28
29 $charitable_campaigns_count = Charitable_Campaigns::query(
30 array(
31 'posts_per_page' => -1,
32 'fields' => 'ids',
33 )
34 )->found_posts;
35 $charitable_campaigns_text = 1 === $charitable_campaigns_count ? __( 'Campaign', 'charitable' ) : __( 'Campaigns', 'charitable' );
36
37 /**
38 * Filter the donation stats to show.
39 *
40 * @since 1.5.0
41 *
42 * @param array $donation_stats The default stats to show.
43 * @param array $view_args All arguments passed to the view.
44 */
45 $charitable_donation_stats = apply_filters(
46 'charitable_donation_stats',
47 array(
48 'campaign_count' => array(
49 'amount' => $charitable_campaigns_count,
50 'description' => $charitable_campaigns_text,
51 ),
52 'donated' => array(
53 'amount' => charitable_format_money( charitable_get_table( 'campaign_donations' )->get_total() ),
54 'description' => __( 'Donated', 'charitable' ),
55 ),
56 'donor_count' => array(
57 'amount' => charitable_get_table( 'donors' )->count_donors_with_donations(),
58 'description' => __( 'Donors', 'charitable' ),
59 ),
60 ),
61 $view_args
62 );
63
64 ?>
65 <ul class="donation-stats">
66 <?php
67 foreach ( $charitable_donation_stats as $charitable_stat ) :
68 printf( '<li><span class="figure">%s</span> %s</li>', esc_html( $charitable_stat['amount'] ), esc_html( $charitable_stat['description'] ) );
69 endforeach;
70 ?>
71 </ul><!-- .donation-stats -->
72 <?php
73
74 /**
75 * Do something after displaying the donation stats.
76 *
77 * @since 1.6.57
78 *
79 * @param array $view_args The view arguments.
80 */
81 do_action( 'charitable_donation_stats_after', $view_args );