Skip to content

Commit

Permalink
update upcoming events slug
Browse files Browse the repository at this point in the history
  • Loading branch information
iandunn committed Dec 5, 2023
1 parent 303e77f commit e36afed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
13 changes: 7 additions & 6 deletions public_html/wp-content/themes/wporg-events-2023/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function get_country_options( array $options ): array {
'label' => __( 'Country', 'wporg' ),
'title' => __( 'Country', 'wporg' ),
'key' => 'country',
'action' => home_url( '/upcoming-events/' ),
'action' => home_url( '/upcoming/' ),
'options' => array(
'meetup' => 'Meetup',
'wordcamp' => 'WordCamp',
Expand Down Expand Up @@ -96,7 +96,7 @@ function get_event_type_options( array $options ): array {
'label' => $label,
'title' => __( 'Type', 'wporg' ),
'key' => 'event_type',
'action' => home_url( '/upcoming-events/' ),
'action' => home_url( '/upcoming/' ),
'options' => array(
'meetup' => 'Meetup',
'wordcamp' => 'WordCamp',
Expand Down Expand Up @@ -124,10 +124,10 @@ function get_format_type_options( array $options ): array {
'label' => $label,
'title' => __( 'Format', 'wporg' ),
'key' => 'format_type',
'action' => home_url( '/upcoming-events/' ),
'action' => home_url( '/upcoming/' ),
'options' => array(
'meetup' => 'Online',
'wordcamp' => 'In Person',
'online' => 'Online',
'in-person' => 'In Person',
),
'selected' => $selected,
);
Expand All @@ -152,10 +152,11 @@ function get_month_options( array $options ): array {
'label' => $label,
'title' => __( 'Month', 'wporg' ),
'key' => 'month',
'action' => home_url( '/upcoming-events/' ),
'action' => home_url( '/upcoming/' ),
'options' => array(
'01' => 'January',
'02' => 'February',
// todo show all months on search and past events template, but only next ~3 months on upcoming events?
),
'selected' => $selected,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ function init() {
*/
function render( $attributes, $content, $block ) {
$facets = array(
'search' => get_query_var( 's' ) ?? '',
'type' => get_query_var( 'event_type' ) ?? '',
'format' => get_query_var( 'format_type' ) ?? '',
'month' => get_query_var( 'month' ) ?? '',
'search' => sanitize_text_field( get_query_var( 's' ) ?? '' ),
'type' => sanitize_text_field( get_query_var( 'event_type' ) ?? '' ),
'format' => sanitize_text_field( get_query_var( 'format_type' ) ?? '' ),
'month' => absint( get_query_var( 'month' ) ?? 0 ),
);
array_walk( $facets, 'sanitize_text_field' );
$facets = array_filter( $facets );

$events = get_events( $attributes['events'], 0, 0, $facets );

Expand Down

0 comments on commit e36afed

Please sign in to comment.