mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘event_venue’ == $params[‘facet_name’] ) {
$post_id = (int) $params[‘post_id’];
if ( ‘event_time’ == get_post_type( $post_id ) ) {
$parent_event_id = (int) get_field( ‘parent_event’, $post_id ); // get the event_time’s parent event
$venue_id = get_field( ‘event_venue’, $parent_event_id ); // get the venue ID
$params[‘facet_value’] = $venue_id;
$params[‘facet_display_value’] = get_the_title( $venue_id );
}
}
return $params;
}, 10, 2 );

{{/gist}}