Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions inc/routes/events/upcoming-counts.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ function extrachill_api_query_upcoming_counts( $taxonomy ) {
INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
INNER JOIN {$wpdb->terms} t ON tt.term_id = t.term_id
INNER JOIN {$wpdb->posts} p ON tr.object_id = p.ID
INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
INNER JOIN {$wpdb->prefix}datamachine_event_dates ed ON p.ID = ed.post_id
WHERE tt.taxonomy = %s
AND p.post_type = 'data_machine_events'
AND p.post_status = 'publish'
AND pm.meta_key = '_datamachine_event_datetime'
AND pm.meta_value >= %s
AND ed.start_datetime >= %s
{$parent_clause}
GROUP BY t.term_id
ORDER BY event_count DESC",
Expand Down Expand Up @@ -207,13 +206,12 @@ function extrachill_api_single_upcoming_count( $slug, $taxonomy ) {
FROM {$wpdb->posts} p
INNER JOIN {$wpdb->term_relationships} tr ON p.ID = tr.object_id
INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
INNER JOIN {$wpdb->prefix}datamachine_event_dates ed ON p.ID = ed.post_id
WHERE tt.term_id = %d
AND tt.taxonomy = %s
AND p.post_type = 'data_machine_events'
AND p.post_status = 'publish'
AND pm.meta_key = '_datamachine_event_datetime'
AND pm.meta_value >= %s",
AND ed.start_datetime >= %s",
$term->term_id,
$taxonomy,
$today
Expand Down
7 changes: 6 additions & 1 deletion inc/routes/tools/markdown-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,12 @@ function extrachill_api_get_event_markdown_meta_lines( WP_Post $post ) {
}

if ( empty( $meta_lines ) ) {
$event_datetime = get_post_meta( $post->ID, '_datamachine_event_datetime', true );
if ( class_exists( '\DataMachineEvents\Core\EventDatesTable' ) ) {
$dates = \DataMachineEvents\Core\EventDatesTable::get( $post->ID );
$event_datetime = $dates ? $dates->start_datetime : '';
} else {
$event_datetime = '';
}
if ( $event_datetime ) {
$dt = new DateTime( $event_datetime, wp_timezone() );
$meta_lines[] = '**Date:** ' . $dt->format( 'F j, Y g:i A' );
Expand Down