// Creates custom dynamic tag {{ resource_type }} that outputs term slugs to be used as classes in a HTML builder element in a Listing Builder listing
// <div class="{{ post:type }} {{ resource_type }}"></div>
add_filter( 'facetwp_builder_dynamic_tag_value', function( $tag_value, $tag_name, $params ) {
if ( 'resource_type' == $tag_name ) {
$terms = wp_get_post_terms( $params['post']->ID, 'resource-type', array( 'fields' => 'slugs' ) );
$tag_value = implode( ' ', $terms );
}
return $tag_value;
}, 10, 3 );