| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Display a list of campaigns. |
| 10 |
* |
| 11 |
* Override this template by copying it to yourtheme/charitable/widgets/campaigns.php |
| 12 |
* |
| 13 |
* @package Charitable/Templates/Widgets |
| 14 |
* @author WP Charitable LLC |
| 15 |
* @since 1.0.0 |
| 16 |
* @version 1.4.18 |
| 17 |
* @version 1.8.8.6 |
| 18 |
*/ |
| 19 |
|
| 20 |
$charitable_campaigns = $view_args['campaigns']; |
| 21 |
$charitable_show_thumbnail = isset( $view_args['show_thumbnail'] ) ? $view_args['show_thumbnail'] : true; |
| 22 |
$charitable_thumbnail_size = apply_filters( 'charitable_campaign_widget_thumbnail_size', 'medium' ); |
| 23 |
|
| 24 |
if ( ! $charitable_campaigns->have_posts() ) : |
| 25 |
return; |
| 26 |
endif; |
| 27 |
|
| 28 |
echo $view_args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 29 |
|
| 30 |
if ( ! empty( $view_args['title'] ) ) : |
| 31 |
|
| 32 |
echo $view_args['before_title'] . $view_args['title'] . $view_args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 33 |
|
| 34 |
endif; |
| 35 |
?> |
| 36 |
<ol class="campaigns"> |
| 37 |
<?php |
| 38 |
while ( $charitable_campaigns->have_posts() ) : |
| 39 |
|
| 40 |
$charitable_campaigns->the_post(); |
| 41 |
|
| 42 |
$charitable_campaign = new Charitable_Campaign( get_the_ID() ); |
| 43 |
?> |
| 44 |
<li class="campaign"> |
| 45 |
<?php |
| 46 |
if ( $charitable_show_thumbnail && has_post_thumbnail() ) : |
| 47 |
|
| 48 |
the_post_thumbnail( $charitable_thumbnail_size ); |
| 49 |
|
| 50 |
endif; |
| 51 |
?> |
| 52 |
<h6 class="campaign-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6> |
| 53 |
<?php if ( ! $charitable_campaign->is_endless() ) : ?> |
| 54 |
<div class="campaign-time-left"><?php echo wp_kses_post( $charitable_campaign->get_time_left() ); ?></div> |
| 55 |
<?php endif ?> |
| 56 |
</li> |
| 57 |
<?php |
| 58 |
endwhile; |
| 59 |
?> |
| 60 |
</ol> |
| 61 |
<?php |
| 62 |
|
| 63 |
echo $view_args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 64 |
|
| 65 |
wp_reset_postdata(); |
| 66 |
|