<?php
/**
* Example of dynamic tag (https://facetwp.com/help-center/listing-templates/listing-builder/#using-dynamic-tags)
* for FacetWP Listing Builder to display a
* Co-Authors Plus template tag https://github.com/Automattic/Co-Authors-Plus/wiki/Template-tags
* See: https://facetwp.com/help-center/using-facetwp-with/co-authors-plus/#using-a-custom-dynamic-tag-to-display-co-authors
*/
add_filter( 'facetwp_builder_dynamic_tag_value', function( $tag_value, $tag_name, $params ) {
if ( 'co:authors' == $tag_name ) {
$tag_value = coauthors_posts_links( ',', ' and ', null, null, false );
}
return $tag_value;
}, 10, 3 );