PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.0
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.0
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 1.8.0 All 210 releases
charitable / templates / donor-loop.php

donor-loop.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.0, at templates/donor-loop.php

97 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Display a list of donors, either for a specific campaign or sitewide.
4 *
5 * Override this template by copying it to yourtheme/charitable/donor-loop.php
6 *
7 * @package Charitable/Templates/Donor
8 * @author WP Charitable LLC
9 * @since 1.5.0
10 * @version 1.8.0
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /* Donors have to be included in the view args. */
19 if ( ! array_key_exists( 'donors', $view_args ) ) {
20 return;
21 }
22
23 $donors = $view_args['donors'];
24 $args = $view_args;
25 $campaign_id = $view_args['campaign'];
26 $hide_if_no_donors = array_key_exists( 'hide_if_no_donors', $view_args ) && $view_args['hide_if_no_donors'];
27
28
29
30 if ( ! charitable_is_campaign_page() && 'current' === $campaign_id ) {
31 return;
32 }
33
34 if ( ! $donors->count() && $hide_if_no_donors ) {
35 return;
36 }
37
38 if ( 'all' == $campaign_id ) {
39 $args['campaign'] = false;
40 } elseif ( 'current' == $campaign_id ) {
41 $args['campaign'] = get_the_ID();
42 }
43
44 $orientation = array_key_exists( 'orientation', $view_args ) ? $view_args['orientation'] : 'vertical';
45 $style = '';
46
47 if ( 'horizontal' == $orientation ) {
48 $width = array_key_exists( 'width', $view_args ) ? $view_args['width'] : get_option( 'thumbnail_size_w', 100 );
49 if ( 100 !== $width ) {
50 $style = '<style>.donors-list.donors-list-horizontal .donor{ width:' . $width . 'px; }</style>';
51 }
52 }
53
54 if ( $donors->count() ) :
55 echo $style;
56 ?>
57 <ol class="donors-list donors-list-<?php echo esc_attr( $orientation ); ?>">
58 <?php
59 foreach ( $donors as $donor ) :
60
61 $args['donor'] = $donor;
62
63 charitable_template( 'donor-loop/donor.php', $args );
64
65 endforeach;
66 ?>
67 </ol>
68 <?php else : ?>
69 <?php if ( is_admin() && 1 === intval( $view_args['builder_preview'] ) ) : ?>
70 <?php
71 /* fake data for preview area */
72 $limit = isset( $view_args['number'] ) && intval( $view_args['number'] > 0 ) && intval( $view_args['number'] <= 10 ) ? intval( $view_args['number'] ) : 10;
73 ?>
74 <ol class="donors-list donors-list-<?php echo esc_attr( $orientation ); ?>">
75 <?php for ( $x = 1; $x <= $limit; $x++ ) : ?>
76 <li class="donor">
77 <?php if ( ! empty( $args['show_avatar'] ) && 1 === intval( $args['show_avatar'] ) ) : ?>
78 <img alt="" src="<?php echo charitable()->get_path( 'directory', false ) . 'assets/images/campaign-builder/fields/donor-wall/avatar.jpg'; ?>" class="avatar avatar-100 photo" loading="lazy" decoding="async" width="100" height="100">
79 <?php endif; ?>
80 <?php if ( ! empty( $args['show_name'] ) && 1 === intval( $args['show_name'] ) ) : ?>
81 <p class="donor-name"><?php _e( 'John Smith', 'charitable' ); ?></p>
82 <?php endif; ?>
83 <?php if ( ! empty( $args['show_location'] ) && 1 === intval( $args['show_location'] ) ) : ?>
84 <div class="donor-location"><?php _e( 'US', 'charitable' ); ?></div>
85 <?php endif; ?>
86 <?php if ( ! empty( $args['show_amount'] ) && 1 === intval( $args['show_amount'] ) ) : ?>
87 <div class="donor-donation-amount"><?php _e( '$100.00', 'charitable' ); ?></div>
88 <?php endif; ?>
89 </li><!-- .donor-x -->
90 <?php endfor; ?>
91 </ol>
92 <?php else : ?>
93 <p><?php echo esc_html__( 'No donors yet. Be the first!', 'charitable' ); ?></p>
94 <?php endif; ?>
95 <?php
96 endif;
97