# charitable/1.7.0.12/templates/widgets/donors.php

Charitable – Donation &amp; Fundraising Platform (Donation Forms, Recurring Donations &amp; Fundraising Campaigns), version 1.7.0.12. 38 lines.

- Page: https://pluginprobe.com/plugins/charitable/1.7.0.12/code/templates/widgets/donors.php
- Raw: https://pluginprobe.com/plugins/charitable/1.7.0.12/raw/templates/widgets/donors.php
- Modified: 2022-09-21T15:01:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/charitable/1.7.0.12/code/templates/widgets/donors.php#L10-L20`.

```php
<?php
/**
 * Display a widget with donors, either for a specific campaign or sitewide.
 *
 * Override this template by copying it to yourtheme/charitable/widgets/donors.php
 *
 * @package Charitable/Templates/Widgets
 * @author  WP Charitable LLC
 * @since   1.0.0
 * @version 1.5.0
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! charitable_is_campaign_page() && 'current' == $view_args['campaign_id'] ) {
	return;
}

$widget_title = apply_filters( 'widget_title', $view_args['title'] );

/* If there are no donors and the widget is configured to hide when empty, return now. */
if ( ! $view_args['donors']->count() && $view_args['hide_if_no_donors'] ) {
	return;
}

echo $view_args['before_widget'];

if ( ! empty( $widget_title ) ) :
	echo $view_args['before_title'] . $widget_title . $view_args['after_title'];
endif;

charitable_template( 'donor-loop.php', $view_args );

echo $view_args['after_widget'];

```
