|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* LSX functions and definitions - The Events Calendar. |
|
4
|
|
|
* |
|
5
|
|
|
* @package lsx |
|
6
|
|
|
* @subpackage the-events-calendar |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
|
|
|
|
|
10
|
|
|
exit; |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
if ( ! function_exists( 'lsx_tec_scripts_add_styles' ) ) : |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* The Events Calendar enqueue styles. |
|
17
|
|
|
* |
|
18
|
|
|
* @package lsx |
|
19
|
|
|
* @subpackage the-events-calendar |
|
20
|
|
|
*/ |
|
21
|
|
|
function lsx_tec_scripts_add_styles() { |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
// Get plugin version. |
|
24
|
|
|
$plugin = 'the-events-calendar/the-events-calendar.php'; |
|
25
|
|
|
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
26
|
|
|
$version = $data['Version']; |
|
27
|
|
|
|
|
28
|
|
|
if ( substr( $version, 0, 1 ) >= '5' ) { |
|
|
|
|
|
|
29
|
|
|
// New Version 5.0 and up. |
|
30
|
|
|
wp_enqueue_style( 'the-events-calendar-lsx', LSX_CUSTOMIZER_URL . 'assets/css/the-events-calendar/the-events-calendar-5.css', array( 'lsx_main' ), LSX_VERSION ); |
|
31
|
|
|
} else { |
|
32
|
|
|
// Old Version. |
|
33
|
|
|
wp_enqueue_style( 'the-events-calendar-lsx', LSX_CUSTOMIZER_URL . 'assets/css/the-events-calendar/the-events-calendar.css', array( 'lsx_main' ), LSX_VERSION ); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
wp_enqueue_style( 'the-events-calendar-lsx', LSX_CUSTOMIZER_URL . 'assets/css/the-events-calendar/the-events-calendar.css', array( 'lsx_main' ), LSX_VERSION ); |
|
37
|
|
|
wp_style_add_data( 'the-events-calendar-lsx', 'rtl', 'replace' ); |
|
38
|
|
|
} |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
add_action( 'wp_enqueue_scripts', 'lsx_tec_scripts_add_styles' ); |
|
41
|
|
|
|
|
|
|
|
|
|
42
|
|
|
endif; |
|
43
|
|
|
|
|
44
|
|
|
if ( ! function_exists( 'lsx_tec_theme_wrapper_start' ) ) : |
|
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* The Events Calendar wrapper start. |
|
48
|
|
|
* |
|
49
|
|
|
* @package lsx |
|
50
|
|
|
* @subpackage the-events-calendar |
|
51
|
|
|
*/ |
|
52
|
|
|
function lsx_tec_theme_wrapper_start() { |
|
|
|
|
|
|
53
|
|
|
if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
|
|
|
|
|
54
|
|
|
return; |
|
55
|
|
|
} |
|
|
|
|
|
|
56
|
|
|
lsx_content_wrap_before(); |
|
57
|
|
|
echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
58
|
|
|
lsx_content_before(); |
|
59
|
|
|
echo '<main id="main" class="site-main" role="main">'; |
|
60
|
|
|
lsx_content_top(); |
|
61
|
|
|
} |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
add_action( 'tribe_events_before_html', 'lsx_tec_theme_wrapper_start', 9 ); |
|
64
|
|
|
|
|
|
|
|
|
|
65
|
|
|
endif; |
|
66
|
|
|
|
|
67
|
|
|
if ( ! function_exists( 'lsx_tec_theme_wrapper_end' ) ) : |
|
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* The Events Calendar wrapper end. |
|
71
|
|
|
* |
|
72
|
|
|
* @package lsx |
|
73
|
|
|
* @subpackage the-events-calendar |
|
74
|
|
|
*/ |
|
75
|
|
|
function lsx_tec_theme_wrapper_end() { |
|
|
|
|
|
|
76
|
|
|
if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
|
|
|
|
|
77
|
|
|
return; |
|
78
|
|
|
} |
|
|
|
|
|
|
79
|
|
|
lsx_content_bottom(); |
|
80
|
|
|
echo '</main>'; |
|
81
|
|
|
lsx_content_after(); |
|
82
|
|
|
echo '</div>'; |
|
83
|
|
|
lsx_content_wrap_after(); |
|
84
|
|
|
} |
|
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
add_action( 'tribe_events_after_html', 'lsx_tec_theme_wrapper_end', 11 ); |
|
87
|
|
|
|
|
|
|
|
|
|
88
|
|
|
endif; |
|
89
|
|
|
|
|
90
|
|
|
if ( ! function_exists( 'lsx_tec_global_header_title' ) ) : |
|
|
|
|
|
|
91
|
|
|
|
|
92
|
|
|
/** |
|
|
|
|
|
|
93
|
|
|
* Move the events title into the global header |
|
94
|
|
|
* |
|
95
|
|
|
* @package lsx |
|
96
|
|
|
* @subpackage the-events-calendar |
|
97
|
|
|
*/ |
|
98
|
|
|
function lsx_tec_global_header_title( $title ) { |
|
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
if ( tribe_is_community_edit_event_page() ) { |
|
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
$is_route = get_query_var( 'WP_Route' ); |
|
103
|
|
|
switch ( $is_route ) { |
|
|
|
|
|
|
104
|
|
|
case 'ce-edit-route': |
|
105
|
|
|
$title = apply_filters( 'tribe_ce_edit_event_page_title', __( 'Edit an Event', 'lsx' ) ); |
|
106
|
|
|
break; |
|
107
|
|
|
|
|
108
|
|
|
case 'ce-edit-organizer-route': |
|
109
|
|
|
$title = __( 'Edit an Organizer', 'lsx' ); |
|
110
|
|
|
break; |
|
111
|
|
|
|
|
112
|
|
|
case 'ce-edit-venue-route': |
|
113
|
|
|
$title = __( 'Edit a Venue', 'lsx' ); |
|
114
|
|
|
break; |
|
115
|
|
|
|
|
116
|
|
|
default: |
|
117
|
|
|
$title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'Submit an Event', 'lsx' ) ); |
|
118
|
|
|
break; |
|
119
|
|
|
} |
|
120
|
|
|
} elseif ( tribe_is_community_my_events_page() ) { |
|
|
|
|
|
|
121
|
|
|
$title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ); |
|
122
|
|
|
} elseif ( tribe_is_event() && ( ! is_tag() ) ) { |
|
|
|
|
|
|
123
|
|
|
$title = tribe_get_events_title(); |
|
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
// Only disable the title after we have retrieved it. |
|
127
|
|
|
add_filter( 'tribe_get_events_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
128
|
|
|
|
|
129
|
|
|
if ( is_singular( 'tribe_events' ) ) { |
|
|
|
|
|
|
130
|
|
|
add_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
if ( class_exists( 'LSX_Banners' ) ) { |
|
|
|
|
|
|
134
|
|
|
if ( is_archive() && is_post_type_archive( 'tribe_events' ) ) { |
|
|
|
|
|
|
135
|
|
|
$options = get_option( '_lsx_settings', false ); |
|
136
|
|
|
if ( is_array( $options ) && isset( $options['tribe_events'] ) && isset( $options['tribe_events']['title'] ) && '' !== $options['tribe_events']['title'] ) { |
|
|
|
|
|
|
137
|
|
|
$title = $options['tribe_events']['title']; |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
|
|
|
|
|
140
|
|
|
$title = '<h1 class="page-title">' . $title . '</h1>'; |
|
141
|
|
|
} |
|
|
|
|
|
|
142
|
|
|
return $title; |
|
143
|
|
|
} |
|
|
|
|
|
|
144
|
|
|
add_filter( 'lsx_banner_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
145
|
|
|
add_filter( 'lsx_global_header_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
146
|
|
|
|
|
|
|
|
|
|
147
|
|
|
endif; |
|
148
|
|
|
|
|
149
|
|
|
if ( ! function_exists( 'lsx_text_disable_body_title' ) ) : |
|
|
|
|
|
|
150
|
|
|
/** |
|
|
|
|
|
|
151
|
|
|
* Disable the events title for the post archive if the dynamic setting is active. |
|
152
|
|
|
* |
|
153
|
|
|
* @param $title |
|
|
|
|
|
|
154
|
|
|
* @return string |
|
155
|
|
|
*/ |
|
156
|
|
|
function lsx_text_disable_body_title( $title ) { |
|
|
|
|
|
|
157
|
|
|
$title = ''; |
|
158
|
|
|
remove_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
|
|
|
|
|
159
|
|
|
return $title; |
|
160
|
|
|
} |
|
|
|
|
|
|
161
|
|
|
|
|
162
|
|
|
endif; |
|
163
|
|
|
|
|
164
|
|
|
if ( ! function_exists( 'lsx_tec_breadcrumb_filter' ) ) : |
|
|
|
|
|
|
165
|
|
|
/** |
|
|
|
|
|
|
166
|
|
|
* Fixes the community events breadcrumb |
|
167
|
|
|
* |
|
168
|
|
|
* @package lsx |
|
169
|
|
|
* @subpackage the-events-calendar |
|
170
|
|
|
*/ |
|
171
|
|
|
function lsx_tec_breadcrumb_filter( $crumbs ) { |
|
|
|
|
|
|
172
|
|
|
|
|
173
|
|
|
if ( tribe_is_venue() || tribe_is_organizer() || tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() ) { |
|
|
|
|
|
|
174
|
|
|
$new_crumbs = array(); |
|
175
|
|
|
$new_crumbs[0] = $crumbs[0]; |
|
176
|
|
|
|
|
177
|
|
|
if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
|
|
|
|
|
178
|
|
|
$new_crumbs[1] = array( |
|
179
|
|
|
0 => __( 'Events', 'lsx' ), |
|
180
|
|
|
1 => get_post_type_archive_link( 'tribe_events' ), |
|
181
|
|
|
); |
|
182
|
|
|
} else { |
|
183
|
|
|
$new_crumbs[1] = array( |
|
184
|
|
|
'text' => __( 'Events', 'lsx' ), |
|
185
|
|
|
'url' => get_post_type_archive_link( 'tribe_events' ), |
|
186
|
|
|
); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
if ( tribe_is_community_my_events_page() ) { |
|
|
|
|
|
|
190
|
|
|
$new_crumbs[2] = $crumbs[2]; |
|
191
|
|
|
} elseif ( tribe_is_community_edit_event_page() ) { |
|
|
|
|
|
|
192
|
|
|
|
|
193
|
|
|
if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
|
|
|
|
|
194
|
|
|
$new_crumbs[2] = array( |
|
195
|
|
|
0 => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
196
|
|
|
1 => tribe_community_events_list_events_link(), |
|
|
|
|
|
|
197
|
|
|
); |
|
198
|
|
|
} else { |
|
199
|
|
|
$new_crumbs[2] = array( |
|
200
|
|
|
'text' => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
201
|
|
|
'url' => tribe_community_events_list_events_link(), |
|
202
|
|
|
); |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
$new_crumbs[3] = $crumbs[2]; |
|
206
|
|
|
} else { |
|
207
|
|
|
$new_crumbs[2] = $crumbs[1]; |
|
208
|
|
|
} |
|
|
|
|
|
|
209
|
|
|
$crumbs = $new_crumbs; |
|
210
|
|
|
} |
|
|
|
|
|
|
211
|
|
|
return $crumbs; |
|
212
|
|
|
} |
|
|
|
|
|
|
213
|
|
|
add_filter( 'wpseo_breadcrumb_links', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
214
|
|
|
add_filter( 'woocommerce_get_breadcrumb', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
215
|
|
|
|
|
|
|
|
|
|
216
|
|
|
endif; |
|
217
|
|
|
|