| 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 Studio 164a |
| 8 |
* @package Charitable/Templates/Campaign |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.2.3 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly |
| 14 |
|
| 15 |
$campaigns = $view_args['campaigns']; |
| 16 |
$columns = $view_args['columns']; |
| 17 |
$args = charitable_campaign_loop_args( $view_args ); |
| 18 |
|
| 19 |
if ( ! $campaigns->have_posts() ) : |
| 20 |
return; |
| 21 |
endif; |
| 22 |
|
| 23 |
if ( $columns > 1 ) : |
| 24 |
$loop_class = sprintf( 'campaign-loop campaign-grid campaign-grid-%d', $columns ); |
| 25 |
else : |
| 26 |
$loop_class = 'campaign-loop campaign-list'; |
| 27 |
endif; |
| 28 |
|
| 29 |
/** |
| 30 |
* @hook charitable_campaign_loop_before |
| 31 |
*/ |
| 32 |
do_action( 'charitable_campaign_loop_before', $campaigns, $args ); |
| 33 |
|
| 34 |
?> |
| 35 |
<ol class="<?php echo $loop_class ?>"> |
| 36 |
|
| 37 |
<?php |
| 38 |
while ( $campaigns->have_posts() ) : |
| 39 |
|
| 40 |
$campaigns->the_post(); |
| 41 |
|
| 42 |
charitable_template( 'campaign-loop/campaign.php', $args ); |
| 43 |
|
| 44 |
endwhile; |
| 45 |
|
| 46 |
wp_reset_postdata(); |
| 47 |
?> |
| 48 |
</ol> |
| 49 |
<?php |
| 50 |
|
| 51 |
/** |
| 52 |
* @hook charitable_campaign_loop_after |
| 53 |
*/ |
| 54 |
do_action( 'charitable_campaign_loop_after', $campaigns, $args ); |
| 55 |
|