-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-event.php
113 lines (80 loc) · 2.41 KB
/
page-event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Template Name: Events Archive
*
* The template for displaying the Events archive page.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package The_Ball_v2
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
get_header();
?>
<!-- page-event.php -->
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<section id="archive-header" class="content-area">
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'page' );
endwhile; // End of the loop.
?>
</section>
<?php if ( $featured_event_loop = locate_template( 'template-parts/loop-events-featured.php' ) ) : ?>
<?php load_template( $featured_event_loop ); ?>
<?php endif; ?>
<?php
// Define query args.
$events_args = [
'post_type' => 'event',
'post_status' => 'publish',
'posts_per_page' => -1,
];
// Newest Events first.
add_filter( 'posts_orderby', 'the_ball_v2_events_sort_desc', 20, 2 );
// The query.
$events = new WP_Query( $events_args );
// Clear sort order filter.
remove_filter( 'posts_orderby', 'the_ball_v2_events_sort_desc', 20 );
if ( $events->have_posts() ) :
?>
<section class="event-list insert-area clear">
<div class="event-list-inner">
<?php global $sof_featured_events; ?>
<?php if ( $sof_featured_events === true ) : ?>
<h2 class="events-title"><?php esc_html_e( 'Ongoing Events', 'the-ball-v2' ); ?></h2>
<?php endif; ?>
<?php
// Init counter for giving items classes.
$post_loop_counter = new The_Ball_v2_Counter();
// Start the loop.
while ( $events->have_posts() ) :
$events->the_post();
// Get mini template.
get_template_part( 'template-parts/content-event-mini' );
endwhile;
// Ditch counter.
$post_loop_counter->remove_filter();
unset( $post_loop_counter );
?>
</div>
</section><!-- .event-list -->
<?php
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'coming-soon' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php if ( $past_loop = locate_template( 'template-parts/loop-events-past.php' ) ) : ?>
<?php the_ball_v2_theme()->loop_link_disable(); ?>
<?php load_template( $past_loop ); ?>
<?php the_ball_v2_theme()->loop_link_enable(); ?>
<?php endif; ?>
<?php
get_sidebar();
get_footer();