FacetWP + Toolkit Types – index related “country” field

mgibbs189

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

function index_related_data( $params, $class ) {
if ( ‘country’ == $params[‘facet_name’] ) {
$brand_id = (int) $params[‘facet_value’];
$country = get_post_meta( $brand_id, ‘wpcf-country’, true );
$params[‘facet_value’] = $country;
$params[‘facet_display_value’] = $country;
}
return $params;
}

add_filter( ‘facetwp_index_row’, ‘index_related_data’, 10, 2 );
{{/gist}}