@tulesi, i’m not sure i get what you’re trying to achieve but…
i think you need to hook into em_after_loop_event_location_title action hook. this is used right after displaying location title, before location details.
you have the $location global variable there, so may do an events query, not tested but should work:
function df_em_after_loop_event_location_title() {
global $location;
$args = array(
// get events for current location
'tax_query' => array(
array(
'taxonomy' => 'event-location',
'field' => 'term_id',
'terms' => $location->term_id,
),
),
// first day of this month
'event_end_after' => date( 'Y-m-01' ), // event_start_after?
// last day of this month
'event_end_before' => date( 'Y-m-t' ) // event_start_before?
);
$location_events = em_get_events( $args );
// are there any events for this month?
if ( ! empty( $location_events ) ) {
echo __( 'Currently booked', 'your-textdomain' );
} else {
echo __( 'Available for booking', 'your-textdomain' );
}
}
// use higher priority to modify the position
add_action( 'em_after_loop_event_location_title', 'df_em_after_loop_event_location_title', 10 );
Regards,
Bartosz / dFactory