| 1 |
<?php |
| 2 |
/** |
| 3 |
* Displays the campaign loop. |
| 4 |
* |
| 5 |
* Override this template by copying it to yourtheme/charitable/campaign-loop.php |
| 6 |
* |
| 7 |
* @author WP Charitable LLC |
| 8 |
* @package Charitable/Templates/Campaign |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.5.7 |
| 11 |
* @version 1.8.8.6 |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
$charitable_campaigns = $view_args['campaigns']; |
| 20 |
|
| 21 |
if ( ! $charitable_campaigns->have_posts() ) : |
| 22 |
return; |
| 23 |
endif; |
| 24 |
|
| 25 |
$charitable_loop_class = charitable_campaign_loop_class( $view_args ); |
| 26 |
$charitable_args = charitable_campaign_loop_args( $view_args ); |
| 27 |
|
| 28 |
/** |
| 29 |
* Add something before the campaign loop. |
| 30 |
* |
| 31 |
* @since 1.5.0 |
| 32 |
* |
| 33 |
* @param WP_Query $campaigns The campaigns. |
| 34 |
* @param array $args Loop args. |
| 35 |
*/ |
| 36 |
do_action( 'charitable_campaign_loop_before', $charitable_campaigns, $charitable_args ); |
| 37 |
|
| 38 |
?> |
| 39 |
<ol class="<?php echo esc_attr( $charitable_loop_class ); ?>"> |
| 40 |
|
| 41 |
<?php |
| 42 |
while ( $charitable_campaigns->have_posts() ) : |
| 43 |
|
| 44 |
$charitable_campaigns->the_post(); |
| 45 |
|
| 46 |
charitable_template( 'campaign-loop/campaign.php', $charitable_args ); |
| 47 |
|
| 48 |
endwhile; |
| 49 |
|
| 50 |
wp_reset_postdata(); |
| 51 |
?> |
| 52 |
</ol> |
| 53 |
<?php |
| 54 |
|
| 55 |
/** |
| 56 |
* Add something after the campaign loop. |
| 57 |
* |
| 58 |
* @since 1.5.0 |
| 59 |
* |
| 60 |
* @param WP_Query $campaigns The campaigns. |
| 61 |
* @param array $args Loop args. |
| 62 |
*/ |
| 63 |
do_action( 'charitable_campaign_loop_after', $charitable_campaigns, $charitable_args ); |
| 64 |
|