So I understand you could do a query searching for all future and happening events.
/**
* Agenda de eventos
*/
$today = date('Y-m-d');
$args = array(
'post_type' => 'post_talk', // seu post type
'posts_per_page' => -1,
'meta_key' => 'data_inicio', // ordena os eventos por data de inicio
'meta_type' => 'DATE',
'orderby' => 'meta_value',
'order' => 'ASC',
// busca todos os eventos que a data de termino seja maior ou igual a hoje
'meta_query' => array(
array(
'key' => 'data_fim',
'compare' => '>=',
'value' => $today,
'type' => 'DATE'
)
),
);
$talks = new WP_Query( $args );
To bring in only the week's events you can combine one more meta_query:
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'data_fim',
'compare' => '>=',
'value' => $today,
'type' => 'DATE'
),
array(
'key' => 'data_inicio',
'compare' => '<=',
'value' => date('Y-m-d', strtotime('+1 week')), // +7 dias
'type' => 'DATE'
)
),