Skip to content

Commit f6af263

Browse files
committed
Show only used tags of next/past events
1 parent 59f5970 commit f6af263

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

archive-sunflower_event.php

+6-13
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,19 @@
6767

6868

6969
<?php
70-
$sunflower_terms = get_terms(
71-
array(
72-
'taxonomy' => 'sunflower_event_tag',
73-
'hide_empty' => true,
74-
)
75-
);
7670

77-
if ( ! $sunflower_is_event_archive ) {
78-
foreach ( $sunflower_terms as $sunflower_term ) {
79-
printf( '<button class="filter" data-filter=".%s">%s</button>', esc_attr( $sunflower_term->slug ), esc_attr( $sunflower_term->name ) );
80-
}
71+
$sunflower_ordered_posts = ( $sunflower_is_event_archive ) ? sunflower_get_past_events() : sunflower_get_next_events();
72+
73+
$sunflower_terms = wp_get_object_terms( wp_list_pluck( $sunflower_ordered_posts->posts, 'ID' ), 'sunflower_event_tag' );
74+
foreach ( $sunflower_terms as $sunflower_term ) {
75+
printf( '<button class="filter" data-filter=".%s">%s</button>', esc_attr( $sunflower_term->slug ), esc_attr( $sunflower_term->name ) );
8176
}
8277
?>
8378
</div>
8479

8580
<div class="row event-list">
8681
<?php
8782

88-
$sunflower_ordered_posts = ( $sunflower_is_event_archive ) ? sunflower_get_past_events() : sunflower_get_next_events();
89-
9083
/* Start the Loop */
9184
while ( $sunflower_ordered_posts->have_posts() ) {
9285
$sunflower_ordered_posts->the_post();
@@ -154,7 +147,7 @@
154147
"map.marker.push( { 'lat' : %s, 'lon': %s, 'content': '%s'} );",
155148
esc_attr( $sunflower_marker->lat ),
156149
esc_attr( $sunflower_marker->lon ),
157-
esc_attr( $sunflower_marker->content )
150+
wp_kses_post( $sunflower_marker->content )
158151
);
159152

160153
$sunflower_lower_lat = min( $sunflower_lower_lat, $sunflower_marker->lat );

0 commit comments

Comments
 (0)