Skip to content

Commit

Permalink
Show only used tags of next/past events (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
albig authored Nov 7, 2024
1 parent 4b78a3b commit 40774be
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions archive-sunflower_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,19 @@


<?php
$sunflower_terms = get_terms(
array(
'taxonomy' => 'sunflower_event_tag',
'hide_empty' => true,
)
);

if ( ! $sunflower_is_event_archive ) {
foreach ( $sunflower_terms as $sunflower_term ) {
printf( '<button class="filter" data-filter=".%s">%s</button>', esc_attr( $sunflower_term->slug ), esc_attr( $sunflower_term->name ) );
}
$sunflower_ordered_posts = ( $sunflower_is_event_archive ) ? sunflower_get_past_events() : sunflower_get_next_events();

$sunflower_terms = wp_get_object_terms( wp_list_pluck( $sunflower_ordered_posts->posts, 'ID' ), 'sunflower_event_tag' );
foreach ( $sunflower_terms as $sunflower_term ) {
printf( '<button class="filter" data-filter=".%s">%s</button>', esc_attr( $sunflower_term->slug ), esc_attr( $sunflower_term->name ) );
}
?>
</div>

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

$sunflower_ordered_posts = ( $sunflower_is_event_archive ) ? sunflower_get_past_events() : sunflower_get_next_events();

/* Start the Loop */
while ( $sunflower_ordered_posts->have_posts() ) {
$sunflower_ordered_posts->the_post();
Expand Down Expand Up @@ -154,7 +147,7 @@
"map.marker.push( { 'lat' : %s, 'lon': %s, 'content': '%s'} );",
esc_attr( $sunflower_marker->lat ),
esc_attr( $sunflower_marker->lon ),
esc_attr( $sunflower_marker->content )
wp_kses_post( $sunflower_marker->content )
);

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

0 comments on commit 40774be

Please sign in to comment.