| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display a widget with donors, either for a specific campaign or sitewide. |
| 4 |
* |
| 5 |
* Override this template by copying it to yourtheme/charitable/widgets/donors.php |
| 6 |
* |
| 7 |
* @package Charitable/Templates/Widgets |
| 8 |
* @author WP Charitable LLC |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.5.0 |
| 11 |
* @version 1.8.8.6 |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
if ( ! charitable_is_campaign_page() && 'current' == $view_args['campaign_id'] ) { |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
$charitable_widget_title = apply_filters( 'widget_title', $view_args['title'] ); |
| 24 |
|
| 25 |
/* If there are no donors and the widget is configured to hide when empty, return now. */ |
| 26 |
if ( ! $view_args['donors']->count() && $view_args['hide_if_no_donors'] ) { |
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
echo $view_args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 31 |
|
| 32 |
if ( ! empty( $charitable_widget_title ) ) : |
| 33 |
echo $view_args['before_title'] . esc_html( $charitable_widget_title ) . $view_args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 34 |
endif; |
| 35 |
|
| 36 |
charitable_template( 'donor-loop.php', $view_args ); |
| 37 |
|
| 38 |
echo $view_args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 39 |
|